Class: Ellen::Action
- Inherits:
-
Object
- Object
- Ellen::Action
- Defined in:
- lib/ellen/action.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#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 = {}, &block) ⇒ Action
constructor
A new instance of Action.
Constructor Details
#initialize(pattern, options = {}, &block) ⇒ Action
Returns a new instance of Action.
5 6 7 8 9 |
# File 'lib/ellen/action.rb', line 5 def initialize(pattern, = {}, &block) @pattern = pattern @options = @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
3 4 5 |
# File 'lib/ellen/action.rb', line 3 def block @block end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/ellen/action.rb', line 3 def @options 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
15 16 17 |
# File 'lib/ellen/action.rb', line 15 def all? !![:all] end |
#call(handler, message) ⇒ Object
11 12 13 |
# File 'lib/ellen/action.rb', line 11 def call(handler, ) handler.robot.instance_exec(, &block) if .match pattern_with(handler.robot.name) end |
#description ⇒ Object
19 20 21 |
# File 'lib/ellen/action.rb', line 19 def description [:description] || "(no description)" end |