Method: MotherBrain::Command#initialize
- Defined in:
- lib/mb/command.rb
#initialize(name, scope, &block) ⇒ Command
Returns a new instance of Command.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/mb/command.rb', line 27 def initialize(name, scope, &block) set_attribute(:name, name.to_s) @scope = scope case @scope when MB::Plugin @plugin = @scope @type = :plugin when MB::Component @plugin = @scope.plugin @type = :component else raise RuntimeError, "no matching command type for the given scope: #{scope}." end if block_given? dsl_eval(&block) end end |