Class: Formalism::Action
- Inherits:
-
Object
- Object
- Formalism::Action
- Defined in:
- lib/formalism/action.rb
Overview
Class for any action
Direct Known Subclasses
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#runnable ⇒ Object
Returns the value of attribute runnable.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Action
constructor
A new instance of Action.
- #run ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Action
Returns a new instance of Action.
19 20 21 22 |
# File 'lib/formalism/action.rb', line 19 def initialize(params = {}) @runnable = true unless defined? @runnable @params = params.deep_dup || {} end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
14 15 16 |
# File 'lib/formalism/action.rb', line 14 def params @params end |
#runnable ⇒ Object
Returns the value of attribute runnable.
15 16 17 |
# File 'lib/formalism/action.rb', line 15 def runnable @runnable end |
Class Method Details
.run(*args) ⇒ Object
9 10 11 |
# File 'lib/formalism/action.rb', line 9 def run(*args) new(*args).run end |
Instance Method Details
#run ⇒ Object
24 25 26 27 28 |
# File 'lib/formalism/action.rb', line 24 def run return unless runnable execute end |