class Geny::Context::View

All templates are evaluated in the context of a View. All command-line options, locals, and helper methods wil be available in templates.

Public Instance Methods

capture(*args, &block) click to toggle source

Capture the ERB rendered inside a block

# File lib/geny/context/view.rb, line 20
def capture(*args, &block)
  @output_buffer, buffer_was = "", @output_buffer

  begin
    block.call(*args)
    block.binding.eval("@output_buffer")
  ensure
    @output_buffer = buffer_was
  end
end
concat(data) click to toggle source

Append to the output buffer

# File lib/geny/context/view.rb, line 15
def concat(data)
  @output_buffer << data
end
merge(updates) click to toggle source

@private

# File lib/geny/context/view.rb, line 10
def merge(updates)
  View.new(command: command, locals: locals.merge(updates))
end