Class: Country
- Inherits:
-
Object
- Object
- Country
- Defined in:
- lib/workarea/ext/freedom_patches/country.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#as_json ⇒ Object
Without this, any Country objects put in JSON render much verbose.
Class Method Details
.search_for(value) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'lib/workarea/ext/freedom_patches/country.rb', line 2 def self.search_for(value) all.detect do |country| country.alpha2.casecmp?(value.to_s) || country.alpha3.casecmp?(value.to_s) || country.name.casecmp?(value.to_s) || country.unofficial_names.any? { |name| name.casecmp?(value.to_s) } end end |
Instance Method Details
#as_json ⇒ Object
Without this, any Country objects put in JSON render much verbose
12 13 14 |
# File 'lib/workarea/ext/freedom_patches/country.rb', line 12 def as_json(*) alpha2 end |