Class: Swarm::WorkitemContext

Inherits:
Object
  • Object
show all
Defined in:
lib/swarm/evaluation/workitem_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workitem) ⇒ WorkitemContext

Returns a new instance of WorkitemContext.



5
6
7
# File 'lib/swarm/evaluation/workitem_context.rb', line 5

def initialize(workitem)
  @workitem = Support.symbolize_keys(workitem)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/swarm/evaluation/workitem_context.rb', line 9

def method_missing(method, *args)
  if workitem.has_key?(method)
    workitem.fetch(method, nil)
  else
    super
  end
end

Instance Attribute Details

#workitemObject (readonly)

Returns the value of attribute workitem.



3
4
5
# File 'lib/swarm/evaluation/workitem_context.rb', line 3

def workitem
  @workitem
end