Class: OAPI::Types::Array

Inherits:
Object
  • Object
show all
Defined in:
lib/oapi/types/array.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store = []) ⇒ Array

Returns a new instance of Array.



6
7
8
9
# File 'lib/oapi/types/array.rb', line 6

def initialize(store = [], &)
  @store = store
  super(&)
end

Class Attribute Details

.item_nameObject (readonly)

Returns the value of attribute item_name.



12
13
14
# File 'lib/oapi/types/array.rb', line 12

def item_name
  @item_name
end

.item_typeObject (readonly)

Returns the value of attribute item_type.



12
13
14
# File 'lib/oapi/types/array.rb', line 12

def item_type
  @item_type
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



4
5
6
# File 'lib/oapi/types/array.rb', line 4

def store
  @store
end

Class Method Details

.item(name, type) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/oapi/types/array.rb', line 14

def item(name, type)
  @item_name = name
  @item_type = type

  define_method(name) do |&block|
    @store << type.new(&block)
  end
end