Class: DataType::Object

Inherits:
Base
  • Object
show all
Defined in:
lib/dsl/data_types/primitives.rb

Overview

Objects

Direct Known Subclasses

Array, Hash, OpenStruct

Instance Attribute Summary

Attributes inherited from Base

#aliases

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, #column, #dangerous_migration_from?, #initialize, long_text_mock, migrant_data_type?, short_text_mock, #structure_changes_from

Constructor Details

This class inherits a constructor from DataType::Base

Class Method Details

.default_mockObject



136
137
138
# File 'lib/dsl/data_types/primitives.rb', line 136

def self.default_mock     
  self.native_class.new
end

.native_classObject



152
153
154
# File 'lib/dsl/data_types/primitives.rb', line 152

def self.native_class
  self.to_s.split('::').last.constantize
end

Instance Method Details

#column_defaultsObject



132
133
134
# File 'lib/dsl/data_types/primitives.rb', line 132

def column_defaults
  {:type => :text }
end

#mockObject



140
141
142
# File 'lib/dsl/data_types/primitives.rb', line 140

def mock
  @value || self.default_mock
end

#serialized?Boolean

Returns:

  • (Boolean)


144
145
146
# File 'lib/dsl/data_types/primitives.rb', line 144

def serialized?
  true
end

#serialized_class_nameObject



148
149
150
# File 'lib/dsl/data_types/primitives.rb', line 148

def serialized_class_name
  self.class.native_class
end