Class: Unit::Types::Hash
- Inherits:
-
Object
- Object
- Unit::Types::Hash
- Defined in:
- lib/unit-ruby/types/hash.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) ⇒ Hash
constructor
A new instance of Hash.
Constructor Details
#initialize(items) ⇒ Hash
Returns a new instance of Hash.
8 9 10 |
# File 'lib/unit-ruby/types/hash.rb', line 8 def initialize(items) @items = items || {} end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
6 7 8 |
# File 'lib/unit-ruby/types/hash.rb', line 6 def items @items end |
Class Method Details
.cast(val) ⇒ Object
12 13 14 15 16 |
# File 'lib/unit-ruby/types/hash.rb', line 12 def self.cast(val) return val if val.is_a? self new(val) end |
Instance Method Details
#as_json_api ⇒ Object
18 19 20 |
# File 'lib/unit-ruby/types/hash.rb', line 18 def as_json_api items end |