Class: Unit::Types::Array

Inherits:
Object
  • Object
show all
Defined in:
lib/unit-ruby/types/array.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(items) ⇒ Array

Returns a new instance of Array.



6
7
8
# File 'lib/unit-ruby/types/array.rb', line 6

def initialize(items)
  @items = items || []
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



4
5
6
# File 'lib/unit-ruby/types/array.rb', line 4

def items
  @items
end

Class Method Details

.cast(val) ⇒ Object



10
11
12
13
14
# File 'lib/unit-ruby/types/array.rb', line 10

def self.cast(val)
  return val if val.is_a? self

  new(val)
end

Instance Method Details

#as_json_apiObject



16
17
18
# File 'lib/unit-ruby/types/array.rb', line 16

def as_json_api
  items
end