Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed handling of to_show when all parts ignored

  • Loading branch information...
commit d53be3edb73d144bc16dd436bdb9127efaf72314 1 parent e443b96
@ethn ethn authored
Showing with 7 additions and 4 deletions.
  1. +6 −4 lib/wagn/cardname.rb
  2. +1 −0  spec/lib/wagn/cardname_spec.rb
View
10 lib/wagn/cardname.rb
@@ -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
View
1  spec/lib/wagn/cardname_spec.rb
@@ -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'
Please sign in to comment.
Something went wrong with that request. Please try again.