Class: Unit::Types::Array
- Inherits:
-
Object
- Object
- Unit::Types::Array
- Defined in:
- lib/unit-ruby/types/array.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json_api ⇒ Object
-
#initialize(items) ⇒ Array
constructor
A new instance of Array.
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
#items ⇒ Object (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_api ⇒ Object
16 17 18 |
# File 'lib/unit-ruby/types/array.rb', line 16 def as_json_api items end |