Class: JamScriptHighlighter::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/jam_script_highlighter/line.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#textObject

Returns the value of attribute text.



3
4
5
# File 'lib/jam_script_highlighter/line.rb', line 3

def text
  @text
end

Class Method Details

.new(text, type = nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/jam_script_highlighter/line.rb', line 10

def new text, type=nil
  if type
    class_name = "#{type.to_s.split('_').map{|e| e.capitalize}.join}Line"
    cls = JamScriptHighlighter::LineTypes.const_get(class_name)
    cls.new text
  else
    ret = super()
    ret.text = text

    ret
  end
end

Instance Method Details

#to_htmlObject



5
6
7
# File 'lib/jam_script_highlighter/line.rb', line 5

def to_html
  @text || ''
end