Class: Kapusta::List
- Inherits:
-
Object
- Object
- Kapusta::List
- Defined in:
- lib/kapusta/ast.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#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.
- #rest ⇒ Object
Constructor Details
#initialize(items) ⇒ List
Returns a new instance of List.
113 114 115 116 |
# File 'lib/kapusta/ast.rb', line 113 def initialize(items) @items = items @multiline_source = false end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
110 111 112 |
# File 'lib/kapusta/ast.rb', line 110 def items @items end |
#multiline_source ⇒ Object
Returns the value of attribute multiline_source.
111 112 113 |
# File 'lib/kapusta/ast.rb', line 111 def multiline_source @multiline_source end |
Instance Method Details
#empty? ⇒ Boolean
126 127 128 |
# File 'lib/kapusta/ast.rb', line 126 def empty? @items.empty? end |
#head ⇒ Object
118 119 120 |
# File 'lib/kapusta/ast.rb', line 118 def head @items.first end |
#rest ⇒ Object
122 123 124 |
# File 'lib/kapusta/ast.rb', line 122 def rest @items[1..] || [] end |