Class: NoSE::Fields::IDField

Inherits:
Field show all
Defined in:
lib/nose/model/fields.rb

Overview

Field holding a unique identifier

Direct Known Subclasses

ForeignKeyField

Constant Summary

Constants inherited from Field

Field::TYPE

Instance Attribute Summary

Attributes inherited from Field

#name, #parent, #primary_key, #size

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Field

#*, #==, #cardinality, #hash, #id, #to_color, #to_s

Methods included from Supertype

included

Constructor Details

#initialize(name, **options) ⇒ IDField

Returns a new instance of IDField.



255
256
257
258
# File 'lib/nose/model/fields.rb', line 255

def initialize(name, **options)
  super(name, 16, **options)
  @primary_key = true
end

Class Method Details

.value_from_string(string) ⇒ String

Return the String parameter as-is

Returns:

  • (String)


262
263
264
# File 'lib/nose/model/fields.rb', line 262

def self.value_from_string(string)
  string
end

Instance Method Details

#random_valuenil

nil value which is interpreted by the backend as requesting a new ID

Returns:

  • (nil)


268
269
270
# File 'lib/nose/model/fields.rb', line 268

def random_value
  nil
end