Class: Ridley::CommandContext::Base
- Inherits:
-
Object
- Object
- Ridley::CommandContext::Base
- Defined in:
- lib/ridley/command_context.rb
Overview
A base class to provide common functionality between OS specific command contexts. A command context takes an options hash and binds it against a template file. You can then retrieve the command to be run on a node by calling #command.
Class Method Summary collapse
-
.command(options = {}) ⇒ Object
Build a command context and immediately run it’s command.
-
.template_file(filename = nil) ⇒ Pathname
Set or get the path to the template file for the inheriting class.
Instance Method Summary collapse
- #command ⇒ String
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
36 |
# File 'lib/ridley/command_context.rb', line 36 def initialize( = {}); end |
Class Method Details
.command(options = {}) ⇒ Object
Build a command context and immediately run it’s command
18 19 20 |
# File 'lib/ridley/command_context.rb', line 18 def command( = {}) new().command end |
.template_file(filename = nil) ⇒ Pathname
Set or get the path to the template file for the inheriting class
29 30 31 32 |
# File 'lib/ridley/command_context.rb', line 29 def template_file(filename = nil) return @template_file if filename.nil? @template_file = Ridley.scripts.join("#{filename}.erb") end |
Instance Method Details
#command ⇒ String
39 40 41 |
# File 'lib/ridley/command_context.rb', line 39 def command template.evaluate(self) end |