Sha256: 7d09d54a8a025dab85e5b62cf76e05ed8fefef2f280a1082385aa0f33730c63b
Contents?: true
Size: 705 Bytes
Versions: 2
Compression:
Stored size: 705 Bytes
Contents
class Plastic # ActiveMerchant::Billing::CreditCard DUCK_TYPE_INTERFACE = [ [:number, :pan], [:first_name, :given_name], [:last_name, :surname], [:verification_value, :cvv2], [:security_code, :cvv2], [:expiration_date, :expiration], [:track1, :track_1], [:track2, :track_2], ] DUCK_TYPE_INTERFACE.each do |_alias, attribute_name| alias_method _alias, attribute_name alias_method :"#{_alias}=", :"#{attribute_name}=" define_method :"#{_alias}?", lambda { value_is_present?(send(_alias)) } end def year expiration ? DateTime.new(expiration_year).strftime("%y") : nil end def month expiration ? "%02d" % expiration_month : nil end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
plastic-0.2.2 | lib/plastic/duck_type.rb |
plastic-0.2.1 | lib/plastic/duck_type.rb |