lib/active_text/base.rb in active_text-0.0.5 vs lib/active_text/base.rb in active_text-0.0.6
- old
+ new
@@ -12,13 +12,15 @@
options[:comment] ||= /\/\//
options[:context] ||= "(^(?:#{options[:comment]}\s@.*#{options[:eol]}){#{options[:context_lines]}})"
@options = options
# instantiate all variables
- @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])
- @variables.merge!({variable_name.to_sym => variable})
+ 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])
+ @variables.merge!({variable_name.to_sym => variable})
+ end
end
end
end
def update_attributes(args)