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.
58
59
60
|
# File 'lib/active_harness/pricing.rb', line 58
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
70
71
72
73
74
75
76
77
|
# File 'lib/active_harness/pricing.rb', line 70
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
62
63
64
|
# File 'lib/active_harness/pricing.rb', line 62
def [](name)
source.for_provider(name.to_s)
end
|
#list ⇒ Object
66
67
68
|
# File 'lib/active_harness/pricing.rb', line 66
def list
source.provider_names
end
|
#respond_to_missing?(name, include_private = false) ⇒ Boolean
79
80
81
|
# File 'lib/active_harness/pricing.rb', line 79
def respond_to_missing?(name, include_private = false)
source.provider_names.include?(name.to_s) || super
end
|