class ItemProcessor

Attributes

context[R]
source[R]

Public Class Methods

new(source, context) click to toggle source
# File lib/textplacer/item_processor.rb, line 4
def initialize(source, context)
  @source = source.dup
  @context = context
end

Public Instance Methods

perform() click to toggle source
# File lib/textplacer/item_processor.rb, line 9
def perform
  items = source.scan /({{(.+?)}})/m
  items.each do |replace, key|
    source.gsub! replace, context.indifferent_fetch(key).to_s
  end
  source
end