Class: Perennial::Application::CommandEnv

Inherits:
Object
  • Object
show all
Includes:
Loggable
Defined in:
lib/perennial/application.rb

Direct Known Subclasses

Generator::CommandEnv

Class Method Summary collapse

Methods included from Loggable

included, #logger

Class Method Details

.execute(blk, arguments) ⇒ Object

Executes a given block with given arguments in a specified environment. Used to provide the logger functionality as well as the ability to do things such as easily write generators.



12
13
14
15
16
# File 'lib/perennial/application.rb', line 12

def self.execute(blk, arguments)
  klass = Class.new(self)
  klass.class_eval { define_method(:apply, &blk) }
  klass.new.apply(*arguments)
end