From 2daebb750e5be2a4006a4c0cb92dd5bce980901d Mon Sep 17 00:00:00 2001 From: Sebastian Celis Date: Fri, 10 Feb 2012 18:50:31 -0600 Subject: [PATCH] Do not print a string that has no tag. This matches the README description. We really want to encourage users to use tags. Otherwise it becomes easy to accidentally have a string go to too many destination files. --- lib/twine/stringsfile.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/twine/stringsfile.rb b/lib/twine/stringsfile.rb index 07aa299..82d534e 100644 --- a/lib/twine/stringsfile.rb +++ b/lib/twine/stringsfile.rb @@ -23,12 +23,13 @@ module Twine end def matches_tags?(tags) - # The user did not specify any tags. Everything passes. - if tags == nil || tags.length == 0 + if @tags == nil || @tags.length == 0 + # This row has no tags. Never match + return false + elsif tags == nil || tags.length == 0 + # The user did not specify any tags. Everything passes. return true - end - - if tags != nil && @tags != nil + else tags.each do |tag| if @tags.include? tag return true