Method: Ripe::Blocks::ERBBlock#command
- Defined in:
- lib/ripe/blocks/erb_block.rb
#command ⇒ String
Return the string command of the subtree starting at the current block.
The resulting string contains the render result of the liquid template based on the parameters specified in vars.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ripe/blocks/erb_block.rb', line 39 def command vars = @vars vars.define_singleton_method(:get_binding) { binding } # Expose private method vars.define_singleton_method(:method_missing) do |name| return self[name] if key? name self.each { |k,v| return v if k.to_s.to_sym == name } # super.method_missing name end template = <<-EOF.gsub(/^[ ]+/, '') # <#{id}> exec 1>"<%= vars.log %>" 2>&1 #{File.new(@filename).read} echo "##.DONE.##" # </#{id}> EOF ERB.new(template).result(vars.get_binding) end |