Class: Ccp::Invokers::Base

Inherits:
Object
  • Object
show all
Includes:
Commands::Composite
Defined in:
lib/ccp/invokers/base.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :profile => false,
  :comment => true,
}

Instance Method Summary collapse

Methods included from Commands::Composite

#<<, #commands, included

Methods included from Commands::Core

#inspect

Methods included from Commands::Commentable

#MEMO, #TODO

Constructor Details

#initialize(options = nil) ⇒ Base

Instance Methods



20
21
22
23
24
# File 'lib/ccp/invokers/base.rb', line 20

def initialize(options = nil)
  self.receiver = self.class.receiver.new
  self.class.prepend_command Commands::RuntimeArgs, options
  set_default_options
end

Instance Method Details

#benchmarkObject



37
38
39
40
41
42
# File 'lib/ccp/invokers/base.rb', line 37

def benchmark
  before
  super
  after
  return true
end

#executeObject



33
34
35
# File 'lib/ccp/invokers/base.rb', line 33

def execute
  benchmark
end

#receiverObject



44
45
46
# File 'lib/ccp/invokers/base.rb', line 44

def receiver
  @receiver.must(Receivers::Base)
end

#receiver=(value) ⇒ Object



48
49
50
# File 'lib/ccp/invokers/base.rb', line 48

def receiver=(value)
  @receiver = value.must(Receivers::Base)
end

#set_default_optionsObject



26
27
28
29
30
31
# File 'lib/ccp/invokers/base.rb', line 26

def set_default_options
  self.class::DEFAULT_OPTIONS.each_pair do |key,val|
    data.default[key] = val
  end
  data.default(:logger) { Logger.new($stderr) }
end