lib/junoser/display/config_store.rb in junoser-0.3.6 vs lib/junoser/display/config_store.rb in junoser-0.3.7
- old
+ new
@@ -24,20 +24,20 @@
end
end
alias << push
def deactivate(deactivated_line)
- statement, store = matched(deactivated_line)
+ statement, store = match(deactivated_line)
if statement
if statement == deactivated_line
store.deactivated = true
else
store.deactivate(deactivated_line.sub(/^#{statement} */, ''))
end
else
- statement, store = inverse_matched(deactivated_line)
+ statement, store = inverse_match(deactivated_line)
if statement
store.deactivated = true
end
end
end
@@ -73,22 +73,22 @@
str.gsub!(/\narg\((.*)\)$/) { " #$1" }
str.gsub!(/arg\((.*)\)/) { "#$1" }
str
end
- def matched(str)
+ def match(str)
each do |statement, store|
# NOTE: return the first object
- return [statement, store] if str =~ /^#{statement}/
+ return [statement, store] if str =~ /^#{Regexp.escape(statement)}(\b|$)/
end
[]
end
- def inverse_matched(str)
+ def inverse_match(str)
each do |statement, store|
# NOTE: return the first object
- return [statement, store] if statement =~ /^#{str}/
+ return [statement, store] if statement =~ /^#{str}\b/
end
[]
end
end