Class Index [+]

Quicksearch

Erubis::Converter

convert

Attributes

preamble[RW]
postamble[RW]
escape[RW]

Public Instance Methods

convert(input) click to toggle source

convert input string into target language

    # File lib/erubis/converter.rb, line 33
33:     def convert(input)
34:       codebuf = ""    # or []
35:       @preamble.nil? ? add_preamble(codebuf) : (@preamble && (codebuf << @preamble))
36:       convert_input(codebuf, input)
37:       @postamble.nil? ? add_postamble(codebuf) : (@postamble && (codebuf << @postamble))
38:       @_proc = nil    # clear cached proc object
39:       return codebuf  # or codebuf.join()
40:     end
init_converter(properties={}) click to toggle source
    # File lib/erubis/converter.rb, line 26
26:     def init_converter(properties={})
27:       @preamble  = properties[:preamble]
28:       @postamble = properties[:postamble]
29:       @escape    = properties[:escape]
30:     end

Protected Instance Methods

convert_input(codebuf, input) click to toggle source

(abstract) convert input to code

    # File lib/erubis/converter.rb, line 77
77:     def convert_input(codebuf, input)
78:       not_implemented
79:     end
detect_spaces_at_bol(text, is_bol) click to toggle source

detect spaces at beginning of line

    # File lib/erubis/converter.rb, line 47
47:     def detect_spaces_at_bol(text, is_bol)
48:       lspace = nil
49:       if text.empty?
50:         lspace = "" if is_bol
51:       elsif text[1] == \n\
52:         lspace = ""
53:       else
54:         rindex = text.rindex(\n\)
55:         if rindex
56:           s = text[rindex+1..1]
57:           if s =~ /\A[ \t]*\z/
58:             lspace = s
59:             #text = text[0..rindex]
60:             text[rindex+1..1] = ''
61:           end
62:         else
63:           if is_bol && text =~ /\A[ \t]*\z/
64:             #lspace = text
65:             #text = nil
66:             lspace = text.dup
67:             text[0..1] = ''
68:           end
69:         end
70:       end
71:       return lspace
72:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.