Class: Vessel::Cargo::Fields

Inherits:
Object
  • Object
show all
Defined in:
lib/vessel/cargo/fields.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#serviceObject (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

#countObject



25
26
27
# File 'lib/vessel/cargo/fields.rb', line 25

def count
  @fields.count
end

#eachObject



49
50
51
# File 'lib/vessel/cargo/fields.rb', line 49

def each(&)
  @fields.each(&)
end

#key?(value) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/vessel/cargo/fields.rb', line 37

def key?(value)
  @fields.key?(value)
end

#keysObject



41
42
43
# File 'lib/vessel/cargo/fields.rb', line 41

def keys
  @fields.keys
end

#selectObject



29
30
31
# File 'lib/vessel/cargo/fields.rb', line 29

def select(&)
  @fields.send(:select, &)
end

#to_hObject



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