Class/Module 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
def initialize(model, name, options = {})
  super
  @length = @options.fetch(:length)
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
def length
  if @length.kind_of?(Range)
    @length.max
  else
    @length
  end
end

Protected Instance Methods

typecast_to_primitive(value) click to toggle source

Typecast a value to a String

@param [to_s] value

value to typecast

@return [String]

String constructed from value

@api private

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.