Class: Mcc

Inherits:
Object
  • Object
show all
Defined in:
lib/mcc-ruby/mcc.rb

Class Method Summary collapse

Class Method Details

.allObject



4
5
6
# File 'lib/mcc-ruby/mcc.rb', line 4

def self.all
  @@_all ||= YAML::load_file(File.join(__dir__, 'mcc_codes.yaml'))
end

.code(_code) ⇒ Object



8
9
10
# File 'lib/mcc-ruby/mcc.rb', line 8

def self.code(_code)
  all.find { |a| a['mcc'] == _code.to_s }
end

.where(_attr) ⇒ Object



12
13
14
# File 'lib/mcc-ruby/mcc.rb', line 12

def self.where(_attr)
  all.find { |a| a[_attr.keys.first.to_s] == _attr.values.first }
end