Module: YBoss::Result::Item

Included in:
Base::Item
Defined in:
lib/yboss/result/item.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



21
22
23
24
# File 'lib/yboss/result/item.rb', line 21

def method_missing(name, *args, &block)
  raise YBoss::ArgumentException.new("there is no data field called \"#{name}\" here!") unless @data.has_key?(name.to_s)
  @data[name.to_s]
end

Instance Method Details

#each(name, *args) {|@data| ... } ⇒ Object

Yields:

  • (@data)


13
14
15
# File 'lib/yboss/result/item.rb', line 13

def each(name, *args, &block)
  yield @data
end

#initialize(data = {}) ⇒ Object



5
6
7
# File 'lib/yboss/result/item.rb', line 5

def initialize(data = {})
  @data = data
end

#keysObject



9
10
11
# File 'lib/yboss/result/item.rb', line 9

def keys
  @data.keys
end

#to_hashObject



17
18
19
# File 'lib/yboss/result/item.rb', line 17

def to_hash
  @data
end