Class: ReVIEW::HeadlineNode
- Defined in:
- lib/review/node.rb,
lib/review/compiler.rb
Instance Attribute Summary collapse
-
#cmd ⇒ Object
readonly
Returns the value of attribute cmd.
-
#compiler ⇒ Object
readonly
Returns the value of attribute compiler.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
Instance Method Summary collapse
-
#initialize(compiler, position, level, cmd, label, content) ⇒ HeadlineNode
constructor
A new instance of HeadlineNode.
- #to_doc ⇒ Object
- #to_json ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(compiler, position, level, cmd, label, content) ⇒ HeadlineNode
Returns a new instance of HeadlineNode.
997 998 999 1000 1001 1002 1003 1004 |
# File 'lib/review/compiler.rb', line 997 def initialize(compiler, position, level, cmd, label, content) @compiler = compiler @position = position @level = level @cmd = cmd @label = label @content = content end |
Instance Attribute Details
#cmd ⇒ Object (readonly)
Returns the value of attribute cmd.
1008 1009 1010 |
# File 'lib/review/compiler.rb', line 1008 def cmd @cmd end |
#compiler ⇒ Object (readonly)
Returns the value of attribute compiler.
1005 1006 1007 |
# File 'lib/review/compiler.rb', line 1005 def compiler @compiler end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
1010 1011 1012 |
# File 'lib/review/compiler.rb', line 1010 def content @content end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
1009 1010 1011 |
# File 'lib/review/compiler.rb', line 1009 def label @label end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
1007 1008 1009 |
# File 'lib/review/compiler.rb', line 1007 def level @level end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
1006 1007 1008 |
# File 'lib/review/compiler.rb', line 1006 def position @position end |
Instance Method Details
#to_doc ⇒ Object
52 53 54 55 56 57 |
# File 'lib/review/node.rb', line 52 def to_doc content_str = super cmd = @cmd ? @cmd.to_doc : nil label = @label @compiler.compile_headline(@level, cmd, label, content_str) end |
#to_json ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/review/node.rb', line 59 def to_json '{"ruleName":"' + self.class.to_s.sub(/ReVIEW::/,"").sub(/Node$/,"") + '",' + %Q|"cmd":"#{@cmd.to_json}",|+ %Q|"label":"#{@label.to_json}",|+ "\"offset\":#{position.pos},\"line\":#{position.line},\"column\":#{position.col}," + '"childNodes":' + @content.to_json + '}' end |