Included Modules

Class Index [+]

Quicksearch

DataMapper::Property::String

Constants

DEFAULT_LENGTH

Public Class Methods

new(model, name, options = {}) click to toggle source
    # File lib/dm-core/property/string.rb, line 31
31:       def initialize(model, name, options = {})
32:         super
33:         @length = @options.fetch(:length)
34:       end

Public Instance Methods

length() click to toggle source

Returns maximum property length (if applicable). This usually only makes sense when property is of type Range or custom

@return [Integer, nil]

  the maximum length of this property

@api semipublic

    # File lib/dm-core/property/string.rb, line 21
21:       def length
22:         if @length.kind_of?(Range)
23:           @length.max
24:         else
25:           @length
26:         end
27:       end

Protected Instance Methods

typecast_to_primitive(value) click to toggle source

Typecast a value to a String

@param [#] value

  value to typecast

@return [String]

  String constructed from value

@api private

    # File lib/dm-core/property/string.rb, line 45
45:       def typecast_to_primitive(value)
46:         value.to_s
47:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.