class Object
Public Class Methods
allowed_keys()
click to toggle source
# File lib/tiny_template.rb, line 33 def self.allowed_keys @allowed_keys end
Public Instance Methods
interpolate(match, context)
click to toggle source
Private method used to interpolate one single expression at a time
# File lib/tiny_template.rb, line 41 def interpolate(match, context) cleaned = match.gsub(/\{|\}/, '') if !self.class.allowed_keys || self.class.allowed_keys.include?(cleaned) cleaned.split('.') .inject(context){ |result, e| result.public_send(e) } else "" end rescue match end