Class: Pumi::DataSource::Geocoder::AbstractGeocoder::AbstractProvider
- Inherits:
-
Object
- Object
- Pumi::DataSource::Geocoder::AbstractGeocoder::AbstractProvider
- Defined in:
- lib/pumi/data_source/geocoder.rb
Instance Attribute Summary collapse
-
#geocoder ⇒ Object
readonly
Returns the value of attribute geocoder.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(geocoder:, name:) ⇒ AbstractProvider
constructor
A new instance of AbstractProvider.
- #search(term) ⇒ Object
Constructor Details
#initialize(geocoder:, name:) ⇒ AbstractProvider
Returns a new instance of AbstractProvider.
23 24 25 26 |
# File 'lib/pumi/data_source/geocoder.rb', line 23 def initialize(geocoder:, name:) @geocoder = geocoder @name = name end |
Instance Attribute Details
#geocoder ⇒ Object (readonly)
Returns the value of attribute geocoder.
21 22 23 |
# File 'lib/pumi/data_source/geocoder.rb', line 21 def geocoder @geocoder end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
21 22 23 |
# File 'lib/pumi/data_source/geocoder.rb', line 21 def name @name end |
Instance Method Details
#search(term) ⇒ Object
28 29 30 31 32 |
# File 'lib/pumi/data_source/geocoder.rb', line 28 def search(term) geocoder.search(term, lookup: name).map do |result| build_result(result.data) end end |