class ExtendedInterpolationString::LambdaInterpolationString

Constants

INTP_PATERN
NoInterpolatorObjectGiven
VERSION

Attributes

interpolator[RW]

Public Instance Methods

%(options) click to toggle source
# File lib/extended_interpolation_string.rb, line 16
def %(options)
  if options.is_a? Hash
    __getobj__.scan(INTP_PATERN).flatten.each do |requested_key|

      begin
        value = options.fetch(requested_key.to_sym)
        options[requested_key.to_sym] = value
          .call(interpolator || raise(NoInterpolatorObjectGiven)) if value.respond_to?(:call)
      rescue KeyError
      end
    end
  end
  __getobj__ % options
end