Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Talha Meh Talha5

🏠
Working from home
View GitHub Profile
@Talha5
Talha5 / credit_card.rb
Created Jan 29, 2020
Ruby - Credit Card
View credit_card.rb
class CreditCard
attr_accessor :card, :store
def initialize(card_identifier)
@card = card_identifier
@store = {
amex: {begins_with: ["34", "37"], number_length: ["15"]},
discover: {begins_with: ["6011"], number_length: ["16"]},
mastercard: {begins_with: ["51","52","53","54","55"], number_length: ["16"]},
visa: {begins_with: ["4"], number_length: ["13", "16"]},