Class: CouchView::Config::Conditions

Inherits:
Object
  • Object
show all
Defined in:
lib/couch_view/conditions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*conditions) ⇒ Conditions

Returns a new instance of Conditions.



6
7
8
9
# File 'lib/couch_view/conditions.rb', line 6

def initialize(*conditions)
  @conditions = {}
  add_condition_modules conditions
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(condition_name, *args, &block) ⇒ Object



17
18
19
20
21
22
# File 'lib/couch_view/conditions.rb', line 17

def method_missing(condition_name, *args, &block)
  super if block
  super unless args.count == 1

  add_condition_module condition_name, args.first
end

Instance Attribute Details

#conditionsObject (readonly)

Returns the value of attribute conditions.



4
5
6
# File 'lib/couch_view/conditions.rb', line 4

def conditions
  @conditions
end

Instance Method Details

#add_conditions(*args) ⇒ Object Also known as: add_condition



11
12
13
# File 'lib/couch_view/conditions.rb', line 11

def add_conditions(*args)
  add_condition_modules args
end