Class: Vessel::Cargo::Fields
- Inherits:
-
Object
- Object
- Vessel::Cargo::Fields
- Defined in:
- lib/vessel/cargo/fields.rb
Instance Attribute Summary collapse
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #count ⇒ Object
- #each ⇒ Object
-
#initialize(data = nil) ⇒ Fields
constructor
A new instance of Fields.
- #key?(value) ⇒ Boolean
- #keys ⇒ Object
- #select ⇒ Object
- #to_h ⇒ Object
- #values_at(*args) ⇒ Object
- #zip(value) ⇒ Object
Constructor Details
#initialize(data = nil) ⇒ Fields
Returns a new instance of Fields.
8 9 10 11 |
# File 'lib/vessel/cargo/fields.rb', line 8 def initialize(data = nil) @service = {} @fields = data.to_h end |
Instance Attribute Details
#service ⇒ Object (readonly)
Returns the value of attribute service.
6 7 8 |
# File 'lib/vessel/cargo/fields.rb', line 6 def service @service end |
Instance Method Details
#[](key) ⇒ Object
17 18 19 |
# File 'lib/vessel/cargo/fields.rb', line 17 def [](key) @fields[key.to_sym] end |
#[]=(key, value) ⇒ Object
13 14 15 |
# File 'lib/vessel/cargo/fields.rb', line 13 def []=(key, value) @fields[key.to_sym] = value end |
#count ⇒ Object
25 26 27 |
# File 'lib/vessel/cargo/fields.rb', line 25 def count @fields.count end |
#each ⇒ Object
49 50 51 |
# File 'lib/vessel/cargo/fields.rb', line 49 def each(&) @fields.each(&) end |
#key?(value) ⇒ Boolean
37 38 39 |
# File 'lib/vessel/cargo/fields.rb', line 37 def key?(value) @fields.key?(value) end |
#keys ⇒ Object
41 42 43 |
# File 'lib/vessel/cargo/fields.rb', line 41 def keys @fields.keys end |
#select ⇒ Object
29 30 31 |
# File 'lib/vessel/cargo/fields.rb', line 29 def select(&) @fields.send(:select, &) end |
#to_h ⇒ Object
45 46 47 |
# File 'lib/vessel/cargo/fields.rb', line 45 def to_h @fields end |
#values_at(*args) ⇒ Object
21 22 23 |
# File 'lib/vessel/cargo/fields.rb', line 21 def values_at(*args) @fields.values_at(*args) end |
#zip(value) ⇒ Object
33 34 35 |
# File 'lib/vessel/cargo/fields.rb', line 33 def zip(value) @fields.zip(value) end |