Class: Linkage::MergeField

Inherits:
Field show all
Defined in:
lib/linkage/field.rb

Overview

A special field used for merging two Data objects together. It has no dataset or schema.

Constant Summary

Constants inherited from Data

Data::TYPE_CONVERSION_TREE

Instance Attribute Summary collapse

Attributes inherited from Field

#schema

Attributes inherited from Data

#dataset, #name

Instance Method Summary collapse

Methods inherited from Field

#primary_key?, #ruby_type, #static?, #to_expr

Methods inherited from Data

#merge, #ruby_type, #static?, #to_expr

Constructor Details

#initialize(name, ruby_type, database_type = nil) ⇒ MergeField

Create a new instance of MergeField.

Parameters:

  • name (Symbol)

    The field’s name

  • ruby_type (Hash)

    The field’s schema information



101
102
103
104
105
# File 'lib/linkage/field.rb', line 101

def initialize(name, ruby_type, database_type = nil)
  @name = name
  @ruby_type = ruby_type
  @database_type = database_type
end

Instance Attribute Details

#database_typeObject (readonly)

Returns the value of attribute database_type.



95
96
97
# File 'lib/linkage/field.rb', line 95

def database_type
  @database_type
end

Instance Method Details

#collationObject



107
108
109
# File 'lib/linkage/field.rb', line 107

def collation
  @ruby_type.has_key?(:opts) ? @ruby_type[:opts][:collate] : nil
end