class Easyrb::Runner
Constants
- VALID_OPTIONS
Attributes
erb_template[R]
#
Declarations #
#
Public Class Methods
new(erb_template)
click to toggle source
#
Constructor #
#
# File lib/easyrb/runner.rb, line 24 def initialize(erb_template) @erb_template = erb_template end
Public Instance Methods
run(options = {})
click to toggle source
#
Instance Methods #
#
# File lib/easyrb/runner.rb, line 34 def run(options = {}) validate_options!(options) object = Easyrb::Context[options[:context], options[:helpers]] binding = Easyrb::Local[object, options[:locals]] erb.result(binding) end
Private Instance Methods
erb()
click to toggle source
# File lib/easyrb/runner.rb, line 45 def erb ERB.new(erb_template) end
validate_options!(options)
click to toggle source
# File lib/easyrb/runner.rb, line 49 def validate_options!(options) bad_keys = options.keys - VALID_OPTIONS if bad_keys.any? bad_key_string = bad_keys.map { |k| k.inspect }.join(', ') raise ArgumentError, "#erb invalid keys: #{ bad_key_string }" end end