Class: MCC
- Inherits:
-
Object
- Object
- MCC
- Defined in:
- lib/mcc-ruby/mcc.rb
Defined Under Namespace
Classes: Code
Class Method Summary collapse
Class Method Details
._load_data ⇒ Object
16 17 18 |
# File 'lib/mcc-ruby/mcc.rb', line 16 def self._load_data @@_load ||= YAML::load_file(File.join(__dir__, 'mcc_codes.yaml')) end |
.all ⇒ Object
4 5 6 |
# File 'lib/mcc-ruby/mcc.rb', line 4 def self.all _load_data.map { |data| MCC::Code.new(data) } end |
.code(_code) ⇒ Object
8 9 10 |
# File 'lib/mcc-ruby/mcc.rb', line 8 def self.code(_code) all.find { |mcc| mcc.send('mcc') == _code.to_s } end |
.where(_attr) ⇒ Object
12 13 14 |
# File 'lib/mcc-ruby/mcc.rb', line 12 def self.where(_attr) all.select { |mcc| mcc.send(_attr.keys.first.to_s) == _attr.values.first.to_s } end |