lib/active_text/base.rb in active_text-0.0.6 vs lib/active_text/base.rb in active_text-0.0.7
- old
+ new
@@ -16,10 +16,11 @@
# instantiate all variables
if @text
@text.scan(/^\${1}(.+): .+;/).flatten.each do |variable_name|
if has_context?(variable_name)
variable = ActiveText::Variable.new(variable_name, context_of(variable_name), @options[:comment])
+ #puts "Instantiating variable: :#{variable_name} => #{variable.value}"
@variables.merge!({variable_name.to_sym => variable})
end
end
end
end
@@ -29,10 +30,10 @@
send "#{k.to_s}=", v
end
end
# Used to update the text
- def render
+ def apply
@variables.each do |key, var|
@text.gsub!(/^\$#{key}: .+;/, %Q($#{key}: #{var.value};))
end
@text
end