Class: Cb::Utils::Country
- Inherits:
-
Object
- Object
- Cb::Utils::Country
- Defined in:
- lib/cb/utils/country.rb
Class Method Summary collapse
-
.get_supported ⇒ Object
These aren’t all country codes.
- .inject_convenience_methods ⇒ Object
- .is_valid?(country) ⇒ Boolean
Class Method Details
.get_supported ⇒ Object
These aren’t all country codes. We get it. Our naming scheme didn’t hold up over time.
15 16 17 18 19 |
# File 'lib/cb/utils/country.rb', line 15 def self.get_supported %w(AH BE CA CC CE CH CN CP CS CY DE DK E1 ER ES EU F1 FR GC GR I1 IE IN IT J1 JC JS LJ M1 MY NL NO PD PI PL RM RO RX S1 SE SF SG T1 T2 UK US WH WM WR) end |
.inject_convenience_methods ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/cb/utils/country.rb', line 25 def self.inject_convenience_methods get_supported.each do |country| unless self.respond_to? "#{country}" define_singleton_method "#{country}" do return country end end end end |
.is_valid?(country) ⇒ Boolean
21 22 23 |
# File 'lib/cb/utils/country.rb', line 21 def self.is_valid?(country) get_supported.include? country end |