Class: Kapusta::List
- Inherits:
-
Object
- Object
- Kapusta::List
- Defined in:
- lib/kapusta/ast.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#line ⇒ Object
Returns the value of attribute line.
-
#multiline_source ⇒ Object
Returns the value of attribute multiline_source.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #head ⇒ Object
-
#initialize(items) ⇒ List
constructor
A new instance of List.
- #inspect ⇒ Object
- #rest ⇒ Object
Constructor Details
#initialize(items) ⇒ List
Returns a new instance of List.
122 123 124 125 |
# File 'lib/kapusta/ast.rb', line 122 def initialize(items) @items = items @multiline_source = false end |
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column.
120 121 122 |
# File 'lib/kapusta/ast.rb', line 120 def column @column end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
119 120 121 |
# File 'lib/kapusta/ast.rb', line 119 def items @items end |
#line ⇒ Object
Returns the value of attribute line.
120 121 122 |
# File 'lib/kapusta/ast.rb', line 120 def line @line end |
#multiline_source ⇒ Object
Returns the value of attribute multiline_source.
120 121 122 |
# File 'lib/kapusta/ast.rb', line 120 def multiline_source @multiline_source end |
Instance Method Details
#empty? ⇒ Boolean
135 136 137 |
# File 'lib/kapusta/ast.rb', line 135 def empty? @items.empty? end |
#head ⇒ Object
127 128 129 |
# File 'lib/kapusta/ast.rb', line 127 def head @items.first end |
#inspect ⇒ Object
139 140 141 |
# File 'lib/kapusta/ast.rb', line 139 def inspect "(#{@items.map(&:inspect).join(' ')})" end |
#rest ⇒ Object
131 132 133 |
# File 'lib/kapusta/ast.rb', line 131 def rest @items[1..] || [] end |