Class: CountryStateSelect::DataSources::Base
- Inherits:
-
Object
- Object
- CountryStateSelect::DataSources::Base
- Defined in:
- lib/country_state_select/data_sources/base.rb
Overview
Adapter interface. Implement this to back CountryStateSelect with a
different data provider (a database table, the countries gem, a
remote API, ...) instead of the bundled city-state gem — this is
what closes out issue #25 (limited/missing city data) without the
gem itself owning the data problem.
Direct Known Subclasses
Instance Method Summary collapse
-
#cities(_state_code, _country_code) ⇒ Array<String>
City names.
-
#countries ⇒ Hash{Symbol=>String}
ISO code => English country name.
-
#states(_country_code) ⇒ Array<Array(Symbol,String)>
Raw [code, name] pairs.
Instance Method Details
#cities(_state_code, _country_code) ⇒ Array<String>
Returns city names.
22 23 24 |
# File 'lib/country_state_select/data_sources/base.rb', line 22 def cities(_state_code, _country_code) raise NotImplementedError end |
#countries ⇒ Hash{Symbol=>String}
Returns ISO code => English country name.
12 13 14 |
# File 'lib/country_state_select/data_sources/base.rb', line 12 def countries raise NotImplementedError end |
#states(_country_code) ⇒ Array<Array(Symbol,String)>
Returns raw [code, name] pairs.
17 18 19 |
# File 'lib/country_state_select/data_sources/base.rb', line 17 def states(_country_code) raise NotImplementedError end |