class DataType::String

Strings

Public Class Methods

new(options) click to toggle source
Calls superclass method DataType::Base::new
# File lib/dsl/data_types/primitives.rb, line 94
def initialize(options)
  super(options)
  @value ||= ''
end

Public Instance Methods

column_defaults() click to toggle source
Calls superclass method DataType::Base#column_defaults
# File lib/dsl/data_types/primitives.rb, line 99
def column_defaults
  if @value.match(/[\d,]+\.\d{2}$/)
    return Currency.new(@options).column_defaults
  else
    return @value.match(/[\r\n\t]/)? { :type => :text }.merge(@options) : super
  end
end
mock() click to toggle source
# File lib/dsl/data_types/primitives.rb, line 107
def mock
  @value || ((self.column_defaults[:type] == :text)? self.class.long_text_mock : self.class.default_mock )
end