lib/cards_lib/card.rb in cards_lib-0.1.1 vs lib/cards_lib/card.rb in cards_lib-0.1.2
- old
+ new
@@ -51,23 +51,24 @@
# returns other if true
def ordered?(other)
self.sequential?(other) ? other : nil
end
- end
- class InvalidCardFace < Exception; end
- class InvalidRankAndSuit < Exception; end
+ private
+ def face_from_rank_and_suit(rank, suit)
+ if rank && suit
+ [rank, ((rank.length.>(1) && suit.length.>(1)) ? " of " : ""), suit].join
+ else
+ raise InvalidRankAndSuit, "Suit and Rank provided in Hash are invalid!"
+ end
+ end
- private
- def face_from_rank_and_suit(rank, suit)
- if rank && suit
- [rank, ((rank.length.>(1) && suit.length.>(1)) ? " of " : ""), suit].join
- else
- raise InvalidRankAndSuit, "Suit and Rank provided in Hash are invalid!"
+ def if_hash_then_fetch(item, target)
+ item.is_a?(Hash) ? item.fetch(target) { nil } : nil
end
- end
- def if_hash_then_fetch(item, target)
- item.is_a?(Hash) ? item.fetch(target) { nil } : nil
end
+
+ class InvalidCardFace < Exception; end
+ class InvalidRankAndSuit < Exception; end
end