Module: CouchRest::Model::Configuration::ClassMethods

Defined in:
lib/couchrest/model/configuration.rb

Instance Method Summary collapse

Instance Method Details

#add_config(name) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/couchrest/model/configuration.rb', line 42

def add_config(name)
  class_eval "def self.\#{name}(value=nil)\n@\#{name} = value if value\nreturn @\#{name} if self.object_id == \#{self.object_id} || defined?(@\#{name})\nname = superclass.\#{name}\nreturn nil if name.nil? && !instance_variable_defined?(\"@\#{name}\")\n@\#{name} = name && !name.is_a?(Module) && !name.is_a?(Symbol) && !name.is_a?(Numeric) && !name.is_a?(TrueClass) && !name.is_a?(FalseClass) ? name.dup : name\nend\n\ndef self.\#{name}=(value)\n@\#{name} = value\nend\n\ndef \#{name}\nself.class.\#{name}\nend\n", __FILE__, __LINE__ + 1
end

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



62
63
64
# File 'lib/couchrest/model/configuration.rb', line 62

def configure
  yield self
end