lib/controll/commander.rb in controll-0.2.0 vs lib/controll/commander.rb in controll-0.3.0
- old
+ new
@@ -2,14 +2,14 @@
# used to register commands for a controller
class Commander
# makes #command_method available
extend Imperator::Command::MethodFactory
- attr_reader :controller, :options
+ attr_reader :initiator, :options
- def initialize controller, options = {}
- @controller = controller
+ def initialize initiator, options = {}
+ @initiator = initiator
@options = options
end
def command name, *args
send "#{name}_command", *args
@@ -18,7 +18,20 @@
def command! name, *args
command(name, *args).perform
end
alias_method :use_command, :command!
alias_method :perform_command, :command!
+
+ alias_method :controller, :initiator
+
+ class << self
+ def initiator_methods *names
+ delegate names, to: :initiator
+ end
+ alias_method :controller_methods, :initiator_methods
+ end
end
+end
+
+module Commanders
+ Commander = Controll::Commander
end
\ No newline at end of file