Class: ActiveHarness::Pricing::ProvidersProxy
- Inherits:
-
Object
- Object
- ActiveHarness::Pricing::ProvidersProxy
show all
- Defined in:
- lib/active_harness/pricing.rb
Overview
Proxy returned by Pricing.providers — exposes providers as methods and [].
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ProvidersProxy.
72
73
74
|
# File 'lib/active_harness/pricing.rb', line 72
def initialize(source = nil)
@source = source
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
84
85
86
87
88
89
90
91
|
# File 'lib/active_harness/pricing.rb', line 84
def method_missing(name, *args, &block)
provider = name.to_s
if source.provider_names.include?(provider)
source.for_provider(provider)
else
super
end
end
|
Instance Method Details
#[](name) ⇒ Object
76
77
78
|
# File 'lib/active_harness/pricing.rb', line 76
def [](name)
source.for_provider(name.to_s)
end
|
#list ⇒ Object
80
81
82
|
# File 'lib/active_harness/pricing.rb', line 80
def list
source.provider_names
end
|
#respond_to_missing?(name, include_private = false) ⇒ Boolean
93
94
95
|
# File 'lib/active_harness/pricing.rb', line 93
def respond_to_missing?(name, include_private = false)
source.provider_names.include?(name.to_s) || super
end
|