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.



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

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)


273
274
275
# File 'lib/nose/model/fields.rb', line 273

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)


279
280
281
# File 'lib/nose/model/fields.rb', line 279

def random_value
  nil
end