Class: Natsuzora::Contract::AST::List
- Defined in:
- lib/natsuzora/contract/ast/list.rb
Overview
Ordered list of items of a single contract type. Serialized as ‘kind’ => ‘array’ for JSON compatibility.
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(items) ⇒ List
constructor
A new instance of List.
- #to_h ⇒ Object
Constructor Details
#initialize(items) ⇒ List
Returns a new instance of List.
13 14 15 16 |
# File 'lib/natsuzora/contract/ast/list.rb', line 13 def initialize(items) super() @items = items end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
11 12 13 |
# File 'lib/natsuzora/contract/ast/list.rb', line 11 def items @items end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 |
# File 'lib/natsuzora/contract/ast/list.rb', line 22 def ==(other) other.is_a?(List) && other.items == @items end |
#to_h ⇒ Object
18 19 20 |
# File 'lib/natsuzora/contract/ast/list.rb', line 18 def to_h { 'kind' => 'array', 'items' => @items.to_h } end |