Permalink
Browse files

fixed handling of to_show when all parts ignored

  • Loading branch information...
1 parent e443b96 commit d53be3edb73d144bc16dd436bdb9127efaf72314 @ethn ethn committed Nov 19, 2012
Showing with 7 additions and 4 deletions.
  1. +6 −4 lib/wagn/cardname.rb
  2. +1 −0 spec/lib/wagn/cardname_spec.rb
View
@@ -169,11 +169,13 @@ def to_show context, args={}
reject ? nil : part
end
-
- initial_blank = show_parts[0].nil?
show_name = show_parts.compact.to_cardname.s
-
- initial_blank ? JOINT + show_name : show_name
+
+ case
+ when show_parts.compact.empty?; fullname
+ when show_parts[0].nil? ; JOINT + show_name
+ else show_name
+ end
end
@@ -242,6 +242,7 @@
it "ignores ignorables" do
'you+awe'.to_cardname.to_show('A', :ignore=>'you' ).should == '+awe'
'me+you+awe'.to_cardname.to_show('A', :ignore=>'you' ).should == 'me+awe' #HMMM..... what should this do?
+ 'me+you'.to_cardname.to_show('A', :ignore=>['me','you'] ).should == 'me+you'
'me+you+awe'.to_cardname.to_show('A', :ignore=>['me','you'] ).should == '+awe'
'_left+_right+awe'.to_cardname.to_show('A+B', :ignore=>'A' ).should == '+B+awe'
'?a?+awe'.to_cardname.to_show('B', :ignore=>'A' ).should == '+awe'

0 comments on commit d53be3e

Please sign in to comment.