Class: Runfile::Action
- Inherits:
-
Object
- Object
- Runfile::Action
- Defined in:
- lib/runfile/action.rb
Overview
The Action class represents a single Runfile action. This object holds all the information needed to execute it and show its help text (excluding the options, as they are considered global throughout the application)
Instance Attribute Summary collapse
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
-
#execute(args) ⇒ Object
Call the provided block.
-
#initialize(block, usage, help) ⇒ Action
constructor
A new instance of Action.
Constructor Details
#initialize(block, usage, help) ⇒ Action
Returns a new instance of Action.
10 11 12 13 14 |
# File 'lib/runfile/action.rb', line 10 def initialize(block, usage, help) @usage = usage @help = help @block = block end |
Instance Attribute Details
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
8 9 10 |
# File 'lib/runfile/action.rb', line 8 def usage @usage end |
Instance Method Details
#execute(args) ⇒ Object
Call the provided block
17 18 19 |
# File 'lib/runfile/action.rb', line 17 def execute(args) @block.yield args end |