Class: TheRunner::Therunnerfile::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/the_runner/therunnerfile/handler.rb

Constant Summary collapse

@@contexts =
{}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_context(key, context) ⇒ Object



10
11
12
# File 'lib/the_runner/therunnerfile/handler.rb', line 10

def self.add_context(key, context)
  @@contexts[key] = context
end

Instance Method Details

#handle(key) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/the_runner/therunnerfile/handler.rb', line 13

def handle(key)
  key = 'default' if key.nil?
  the_runner = TheRunner.new
  @@contexts.each { |key, value|
    the_runner[key] = value
  }
  the_runner.run(key)
end