class Dolla::CardType

Constants

PREFIXES

Attributes

bank_code[RW]
name[RW]

Public Class Methods

card_code_for_number(number) click to toggle source
# File lib/dolla/card_type.rb, line 16
def self.card_code_for_number number
  codes = self.all.map do |card_type|
    PREFIXES[ card_type.bank_code ].map { |prefix| card_type if number =~ /\A#{ prefix }/ }
  end.flatten.compact.uniq.last
end
new(args = {}) click to toggle source
# File lib/dolla/card_type.rb, line 11
def initialize(args = {})
  @name = args[:name]
  @bank_code = args[:bank_code]
end