Class: Pione::LiterateAction::Handler
- Inherits:
-
Object
- Object
- Pione::LiterateAction::Handler
- Defined in:
- lib/pione/literate-action/handler.rb
Overview
Handler handles action documents.
Instance Method Summary collapse
-
#execute(options = {}) ⇒ Boolean
Execute the action.
-
#initialize(action) ⇒ Handler
constructor
A new instance of Handler.
-
#textize(domain_dump) ⇒ Object
Convert the action to a string.
Constructor Details
#initialize(action) ⇒ Handler
Returns a new instance of Handler.
5 6 7 8 |
# File 'lib/pione/literate-action/handler.rb', line 5 def initialize(action) @lang = action[:lang] || "sh" @content = action[:content] end |
Instance Method Details
#execute(options = {}) ⇒ Boolean
Execute the action.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pione/literate-action/handler.rb', line 27 def execute(={}) location = Location[Temppath.create] location.write(("#!/usr/bin/env %s\n" % @lang) + textize([:domain_dump])) location.path.chmod(0700) = {} [:chdir] = [:chdir] ? [:chdir].path.to_s : Location[Global.pwd].path.to_s [:out] = [:out].path.to_s if .has_key?(:out) return system(location.path.to_s, ) end |
#textize(domain_dump) ⇒ Object
Convert the action to a string.
11 12 13 |
# File 'lib/pione/literate-action/handler.rb', line 11 def textize(domain_dump) @content.to_s end |