Module: ScriptLocator
- Included in:
- BaseProvision, ScriptExecutor
- Defined in:
- lib/script_executor/script_locator.rb
Instance Method Summary collapse
- #evaluate_script_body(content, env, type = :erb) ⇒ Object
- #script_title(script) ⇒ Object
- #scripts(file) ⇒ Object
Instance Method Details
#evaluate_script_body(content, env, type = :erb) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/script_executor/script_locator.rb', line 12 def evaluate_script_body content, env, type=:erb case type when :erb template = ERB.new content template.result(env).strip when :string interpolator = TextInterpolator.new interpolator.interpolate content, env else interpolator = TextInterpolator.new interpolator.interpolate content, env end end |
#script_title(script) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/script_executor/script_locator.rb', line 30 def script_title script if script[0] == '#' StringIO.new(script[1..-1]).readline.strip else nil end end |
#scripts(file) ⇒ Object
6 7 8 9 10 |
# File 'lib/script_executor/script_locator.rb', line 6 def scripts file data = extract_data file locate_scripts(data) end |