[extended-document] added support for property :name, :default => 'Matt" and default couchrest type
This commit is contained in:
parent
890b60cae4
commit
fa7b176fce
5 changed files with 63 additions and 6 deletions
|
@ -2,7 +2,7 @@ module CouchRest
|
|||
|
||||
# Basic attribute support for adding getter/setter + validation
|
||||
class Property
|
||||
attr_reader :name, :type, :read_only, :alias, :options
|
||||
attr_reader :name, :type, :read_only, :alias, :default, :options
|
||||
|
||||
# attribute to define
|
||||
def initialize(name, type = nil, options = {})
|
||||
|
@ -16,9 +16,10 @@ module CouchRest
|
|||
private
|
||||
def parse_options(options)
|
||||
return if options.empty?
|
||||
@validation_format = options.delete(:format) if options[:format]
|
||||
@read_only = options.delete(:read_only) if options[:read_only]
|
||||
@alias = options.delete(:alias) if options[:alias]
|
||||
@validation_format = options.delete(:format) if options[:format]
|
||||
@read_only = options.delete(:read_only) if options[:read_only]
|
||||
@alias = options.delete(:alias) if options[:alias]
|
||||
@default = options.delete(:default) if options[:default]
|
||||
@options = options
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue