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.
4 5 6 7 8 |
# File 'lib/cb/utils/country.rb', line 4 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
14 15 16 17 18 19 20 21 22 |
# File 'lib/cb/utils/country.rb', line 14 def self.inject_convenience_methods get_supported.each do |country| unless self.respond_to? "#{country}" self.define_singleton_method "#{country}" do return country end end end end |
.is_valid?(country) ⇒ Boolean
10 11 12 |
# File 'lib/cb/utils/country.rb', line 10 def self.is_valid?(country) get_supported.include? country end |