lib/ellen/action.rb in ellen-0.0.7 vs lib/ellen/action.rb in ellen-0.0.8
- old
+ new
@@ -1,24 +1,27 @@
module Ellen
class Action
- attr_reader :block, :options, :pattern
+ attr_reader :options, :pattern
- def initialize(pattern, options = {}, &block)
+ def initialize(pattern, options = {})
@pattern = pattern
@options = options
- @block = block
end
def call(handler, message)
- handler.robot.instance_exec(message, &block) if message.match pattern_with(handler.robot.name)
+ handler.send(name, message) if message.match pattern_with(handler.robot.name)
end
def all?
!!options[:all]
end
def description
options[:description] || "(no description)"
+ end
+
+ def name
+ options[:name]
end
private
def pattern_with(name)