Class: CouchView::Proxy
- Inherits:
-
Object
- Object
- CouchView::Proxy
- Extended by:
- Forwardable
- Defined in:
- lib/couch_view/proxy.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#_map ⇒ Object
readonly
Returns the value of attribute _map.
-
#_model ⇒ Object
readonly
Returns the value of attribute _model.
-
#_query_options ⇒ Object
Returns the value of attribute _query_options.
Instance Method Summary collapse
- #_options ⇒ Object
- #each(&block) ⇒ Object
- #get! ⇒ Object
-
#initialize(model, map) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(condition, *args, &block) ⇒ Object
Constructor Details
#initialize(model, map) ⇒ Proxy
Returns a new instance of Proxy.
25 26 27 28 29 30 |
# File 'lib/couch_view/proxy.rb', line 25 def initialize(model, map) @_model = model @_map = map @_conditions = [] @_query_options = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(condition, *args, &block) ⇒ Object
42 43 44 45 46 |
# File 'lib/couch_view/proxy.rb', line 42 def method_missing(condition, *args, &block) condition = remove_exclamation(condition) @_conditions << condition self end |
Instance Attribute Details
#_map ⇒ Object (readonly)
Returns the value of attribute _map.
5 6 7 |
# File 'lib/couch_view/proxy.rb', line 5 def _map @_map end |
#_model ⇒ Object (readonly)
Returns the value of attribute _model.
5 6 7 |
# File 'lib/couch_view/proxy.rb', line 5 def _model @_model end |
#_query_options ⇒ Object
Returns the value of attribute _query_options.
6 7 8 |
# File 'lib/couch_view/proxy.rb', line 6 def @_query_options end |
Instance Method Details
#_options ⇒ Object
32 33 34 |
# File 'lib/couch_view/proxy.rb', line 32 def @_query_options.to_hash end |
#each(&block) ⇒ Object
48 49 50 |
# File 'lib/couch_view/proxy.rb', line 48 def each(&block) _model.send(_map, ).each &block end |
#get! ⇒ Object
52 53 54 |
# File 'lib/couch_view/proxy.rb', line 52 def get! _model.send _map, end |