class DataType::Symbol

Symbol (defaults, specified by user)

Public Instance Methods

column_defaults() click to toggle source
# File lib/dsl/data_types/primitives.rb, line 114
def column_defaults
  # Just construct whatever the user wants
  {:type => ((serialized?)? :text : @value) || :string }.merge(@options)
end
mock() click to toggle source
# File lib/dsl/data_types/primitives.rb, line 119
def mock
  case @value || :string
    when :text then self.class.long_text_mock
    when :string then self.class.short_text_mock
    when :integer then Fixnum.default_mock
    when :decimal, :float then Float.default_mock
    when :datetime, :date then Date.default_mock
    when :serialized, :serialize then (@example)? @example : Hash.default_mock
  end
end
serialized?() click to toggle source
# File lib/dsl/data_types/primitives.rb, line 130
def serialized?
  %W{serialized serialize}.include?(@value.to_s)
end
serialized_class_name() click to toggle source
# File lib/dsl/data_types/primitives.rb, line 134
def serialized_class_name
  klass_name = (@example)? @example.class.to_s : "Hash"      
  
  klass_name.constantize
end