Class: Ellen::Action
- Inherits:
-
Object
- Object
- Ellen::Action
- Defined in:
- lib/ellen/action.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
- #all? ⇒ Boolean
- #call(handler, message) ⇒ Object
- #description ⇒ Object
-
#initialize(pattern, options = {}) ⇒ Action
constructor
A new instance of Action.
- #name ⇒ Object
Constructor Details
#initialize(pattern, options = {}) ⇒ Action
Returns a new instance of Action.
5 6 7 8 |
# File 'lib/ellen/action.rb', line 5 def initialize(pattern, = {}) @pattern = pattern = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/ellen/action.rb', line 3 def end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
3 4 5 |
# File 'lib/ellen/action.rb', line 3 def pattern @pattern end |
Instance Method Details
#all? ⇒ Boolean
14 15 16 |
# File 'lib/ellen/action.rb', line 14 def all? !![:all] end |
#call(handler, message) ⇒ Object
10 11 12 |
# File 'lib/ellen/action.rb', line 10 def call(handler, ) handler.send(name, ) if .match pattern_with(handler.robot.name) end |
#description ⇒ Object
18 19 20 |
# File 'lib/ellen/action.rb', line 18 def description [:description] || "(no description)" end |
#name ⇒ Object
22 23 24 |
# File 'lib/ellen/action.rb', line 22 def name [:name] end |