Class Index [+]

Quicksearch

DataMapper::Subject

Public Instance Methods

default?() click to toggle source

Returns true if the subject has a default value

@return [Boolean]

  true if the subject has a default value

@api semipublic

    # File lib/dm-core/support/subject.rb, line 29
29:     def default?
30:       @options.key?(:default)
31:     end
default_for(resource) click to toggle source

Returns a default value of the subject for given resource

When default value is a callable object, it is called with resource and subject passed as arguments.

@param [Resource] resource

  the model instance for which the default is to be set

@return [Object]

  the default value of this subject for +resource+

@api semipublic

    # File lib/dm-core/support/subject.rb, line 15
15:     def default_for(resource)
16:       if @default.respond_to?(:call)
17:         @default.call(resource, self)
18:       else
19:         DataMapper::Ext.try_dup(@default)
20:       end
21:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.