Class: Runfile::Action

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#usageObject (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