Class: DataType::String
Overview
Strings
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #column_defaults ⇒ Object
-
#initialize(options) ⇒ String
constructor
A new instance of String.
- #mock ⇒ Object
Methods inherited from Base
#==, #column, #column_default_changed?, #dangerous_migration_from?, default_mock, long_text_mock, migrant_data_type?, #serialized?, short_text_mock, #structure_changes_from
Constructor Details
#initialize(options) ⇒ String
Returns a new instance of String.
94 95 96 97 |
# File 'lib/dsl/data_types/primitives.rb', line 94 def initialize() super() @value ||= '' end |
Instance Method Details
#column_defaults ⇒ Object
99 100 101 102 103 104 105 |
# 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 ⇒ Object
107 108 109 |
# 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 |