Class: MicroQ::Proxy::Base
- Inherits:
-
Object
- Object
- MicroQ::Proxy::Base
- Defined in:
- lib/micro_q/proxies/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#at ⇒ Object
readonly
Returns the value of attribute at.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #method_missing(meth, *args) ⇒ Object
- #respond_to?(method) ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
6 7 8 9 10 11 |
# File 'lib/micro_q/proxies/base.rb', line 6 def initialize(={}) @errors = [] @options = parse_and_validate end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/micro_q/proxies/base.rb', line 17 def method_missing(meth, *args) @method = meth.to_s @args = args defaults = [{ :class => klass, :method => method, :args => args }.merge(@options)] defaults << { :when => at } if at MicroQ.push(*defaults) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
4 5 6 |
# File 'lib/micro_q/proxies/base.rb', line 4 def args @args end |
#at ⇒ Object (readonly)
Returns the value of attribute at.
4 5 6 |
# File 'lib/micro_q/proxies/base.rb', line 4 def at @at end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/micro_q/proxies/base.rb', line 4 def errors @errors end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
4 5 6 |
# File 'lib/micro_q/proxies/base.rb', line 4 def klass @klass end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
4 5 6 |
# File 'lib/micro_q/proxies/base.rb', line 4 def method @method end |
Instance Method Details
#respond_to?(method) ⇒ Boolean
32 33 34 |
# File 'lib/micro_q/proxies/base.rb', line 32 def respond_to?(method) super || klass.respond_to?(method) end |
#valid? ⇒ Boolean
13 14 15 |
# File 'lib/micro_q/proxies/base.rb', line 13 def valid? errors.empty? end |