Module: BankCard::Brands

Defined in:
lib/bank_card/brands.rb

Instance Method Summary collapse

Instance Method Details

#detect_brand(number) ⇒ Object



4
5
6
7
8
9
# File 'lib/bank_card/brands.rb', line 4

def detect_brand(number)
  brand = [:visa, :american_express, :master, :jcb, :diners_club, :discover, :maestro].
    detect { |brand| send("#{brand}?", number.to_s) }

  brand ? brand : :unknown
end