Class: Amazon::WebServices::Util::FilterProxy
- Inherits:
-
Object
- Object
- Amazon::WebServices::Util::FilterProxy
- Defined in:
- lib/amazon/webservices/util/filter_proxy.rb
Overview
Filter proxy is a class that can filter argument input before passing onto a proxy object
Usage
Initialize with standard argument block, pass the class or pre-initialized object as the :FilterProxy parameter. All parameters will be passed along to the contructor of the passed class. FilterProxy exposes a FilterChain object, with all the magic which that class provides.
Instance Attribute Summary collapse
-
#filter_chain ⇒ Object
Returns the value of attribute filter_chain.
Instance Method Summary collapse
- #configure(args) ⇒ Object
-
#initialize(args) ⇒ FilterProxy
constructor
A new instance of FilterProxy.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(args) ⇒ FilterProxy
Returns a new instance of FilterProxy.
19 20 21 |
# File 'lib/amazon/webservices/util/filter_proxy.rb', line 19 def initialize(args) @filter_chain = Amazon::Util::FilterChain.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
35 36 37 38 39 |
# File 'lib/amazon/webservices/util/filter_proxy.rb', line 35 def method_missing(method, *args) @filter_chain.execute(method, args) { |method,args| @proxy.send(method,*args) } end |
Instance Attribute Details
#filter_chain ⇒ Object
Returns the value of attribute filter_chain.
17 18 19 |
# File 'lib/amazon/webservices/util/filter_proxy.rb', line 17 def filter_chain @filter_chain end |
Instance Method Details
#configure(args) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/amazon/webservices/util/filter_proxy.rb', line 23 def configure(args) @proxy = case args[:FilterProxy] when Class args[:FilterProxy].new( args ) when nil raise "No FilterProxy or DefaultOverride defined!" unless args[:DefaultOverride].is_a? Proc args[:DefaultOverride].call( args ) else args[:FilterProxy] end end |