Module: CouchRest::Mixins::Properties::ClassMethods
- Defined in:
- lib/couchrest/mixins/properties.rb
Instance Method Summary collapse
Instance Method Details
#property(name, *options) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/couchrest/mixins/properties.rb', line 85 def property(name, *) opts = { } type = .shift if type.class != Hash opts[:type] = type opts.merge!(.shift || {}) else opts.update(type) end existing_property = self.properties.find{|p| p.name == name.to_s} if existing_property.nil? || (existing_property.default != opts[:default]) define_property(name, opts) end end |