Class: Dragonfly::JobDefinitions
- Defined in:
- lib/dragonfly/job_definitions.rb
Instance Method Summary collapse
- #add(name, &definition_proc) ⇒ Object
-
#initialize ⇒ JobDefinitions
constructor
A new instance of JobDefinitions.
Constructor Details
#initialize ⇒ JobDefinitions
Returns a new instance of JobDefinitions.
4 5 6 |
# File 'lib/dragonfly/job_definitions.rb', line 4 def initialize @job_definitions = {} end |
Instance Method Details
#add(name, &definition_proc) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/dragonfly/job_definitions.rb', line 8 def add(name, &definition_proc) job_definitions[name] = JobBuilder.new(&definition_proc) jd = job_definitions # Needed because we're about to change 'self' define_method name do |*args| jd[name].build(self, *args) end define_method "#{name}!" do |*args| jd[name].build!(self, *args) end end |