Class: Google::Maps::PlaceDetails::AddressComponentsProxy
- Inherits:
-
Object
- Object
- Google::Maps::PlaceDetails::AddressComponentsProxy
- Defined in:
- lib/google_maps/place.rb
Instance Method Summary collapse
-
#initialize(address_components) ⇒ AddressComponentsProxy
constructor
A new instance of AddressComponentsProxy.
- #method_missing(method_name, *args) ⇒ Object
- #respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
Constructor Details
#initialize(address_components) ⇒ AddressComponentsProxy
Returns a new instance of AddressComponentsProxy.
87 88 89 |
# File 'lib/google_maps/place.rb', line 87 def initialize(address_components) @address_components = address_components end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/google_maps/place.rb', line 91 def method_missing(method_name, *args) raise ArgumentError unless args.empty? @address_components.find do |component| component.types.first == method_name.to_s end end |
Instance Method Details
#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
99 100 101 102 103 |
# File 'lib/google_maps/place.rb', line 99 def respond_to_missing?(method_name, _include_private = false) @address_components.any? do |component| component.types.first == method_name.to_s end end |