Sha256: 060f417874717678f5bea1744eff352db8fc812e64a72612afab54e125ed2ff4

Contents?: true

Size: 405 Bytes

Versions: 2

Compression:

Stored size: 405 Bytes

Contents

require "yaml"
require "credit_card_detector/brand"

module CreditCardDetector
  module Data
    DATA = File.expand_path("../../data/brands.yaml", __FILE__)

    class << self
      def brands
        @data ||= raw_data.map { |key, data| Brand.new key, data }
      end

      def ids
        @ids ||= brands.map(&:id)
      end

      def raw_data
        YAML.load_file DATA
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
credit_card_detector-0.4 lib/credit_card_detector/data.rb
credit_card_detector-0.3 lib/credit_card_detector/data.rb