Class: JFlow::Activity::Map

Inherits:
Object
  • Object
show all
Defined in:
lib/jflow/activity/map.rb

Instance Method Summary collapse

Constructor Details

#initializeMap

Returns a new instance of Map.



4
5
6
# File 'lib/jflow/activity/map.rb', line 4

def initialize
  @map = {}
end

Instance Method Details

#add_activity(name, version, klass, options) ⇒ Object



8
9
10
11
12
# File 'lib/jflow/activity/map.rb', line 8

def add_activity(name, version, klass, options)
  @map ||= {}
  @map[name] ||= {}
  @map[name][version] = {:class => klass, :options => options}
end

#klass_for(name, version) ⇒ Object



14
15
16
17
# File 'lib/jflow/activity/map.rb', line 14

def klass_for(name, version)
  return nil if !@map.has_key?(name) || !@map[name][version]
  @map[name][version][:class]
end

#options_for(name, version) ⇒ Object



19
20
21
22
# File 'lib/jflow/activity/map.rb', line 19

def options_for(name, version)
  return nil if !@map.has_key?(name) || !@map[name][version]
  @map[name][version][:options]
end