Sha256: 1faa1da9d851422b288af819716b576063964acdaf777770d2013b7d531a3470

Contents?: true

Size: 406 Bytes

Versions: 62

Compression:

Stored size: 406 Bytes

Contents

class Country
  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

  # Without this, any Country objects put in JSON render much verbose
  def as_json(*)
    alpha2
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.5.26 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.4.45 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.5.25 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.5.23 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.4.44 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.5.22 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.4.43 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.5.21 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.4.42 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.5.20 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.4.41 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.5.19 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.4.40 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.5.18 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.4.39 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.5.17 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.4.38 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.5.16 lib/workarea/ext/freedom_patches/country.rb
workarea-core-3.4.37 lib/workarea/ext/freedom_patches/country.rb