Skip to content

Instantly share code, notes, and snippets.

View Talha5's full-sized avatar
🏠
Working from home

Talha Meh Talha5

🏠
Working from home
View GitHub Profile
@Talha5
Talha5 / credit_card.rb
Created January 29, 2020 10:17
Ruby - Credit Card
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"]},