Class: Giter8::Literal
- Inherits:
-
Object
- Object
- Giter8::Literal
- Extended by:
- Forwardable
- Defined in:
- lib/giter8/literal.rb
Overview
Literal represents a sequence of one or more characters not separated by either a Template or Condition node.
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#line ⇒ Object
Returns the value of attribute line.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#source ⇒ Object
Returns the value of attribute source.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, parent, source, line, column) ⇒ Literal
constructor
A new instance of Literal.
- #inspect ⇒ Object
-
#linebreak? ⇒ Boolean
Returns whether this node’s value is comprised solely of a linebreak.
Constructor Details
#initialize(value, parent, source, line, column) ⇒ Literal
Returns a new instance of Literal.
10 11 12 13 14 15 16 |
# File 'lib/giter8/literal.rb', line 10 def initialize(value, parent, source, line, column) @source = source @line = line @column = column @value = value @parent = parent end |
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column.
8 9 10 |
# File 'lib/giter8/literal.rb', line 8 def column @column end |
#line ⇒ Object
Returns the value of attribute line.
8 9 10 |
# File 'lib/giter8/literal.rb', line 8 def line @line end |
#parent ⇒ Object
Returns the value of attribute parent.
8 9 10 |
# File 'lib/giter8/literal.rb', line 8 def parent @parent end |
#source ⇒ Object
Returns the value of attribute source.
8 9 10 |
# File 'lib/giter8/literal.rb', line 8 def source @source end |
#value ⇒ Object
Returns the value of attribute value.
8 9 10 |
# File 'lib/giter8/literal.rb', line 8 def value @value end |
Instance Method Details
#inspect ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/giter8/literal.rb', line 26 def inspect parent = @parent parent = if parent.nil? "nil" else "#<#{@parent.class.name}:#{format("%08x", (@parent.object_id * 2))}>" end "#<#{self.class.name}:#{format("%08x", (object_id * 2))} line=#{@line} value=#{@value.inspect} parent=#{parent}>" end |
#linebreak? ⇒ Boolean
Returns whether this node’s value is comprised solely of a linebreak
22 23 24 |
# File 'lib/giter8/literal.rb', line 22 def linebreak? ["\r\n", "\n"].include? @value end |