Class: NoSE::Fields::StringField

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

Overview

Field holding a string of some average length

Constant Summary collapse

TYPE =

Strings are stored as strings

String

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, length = 10, **options) ⇒ StringField

Returns a new instance of StringField.



193
194
195
# File 'lib/nose/model/fields.rb', line 193

def initialize(name, length = 10, **options)
  super(name, length, **options)
end

Class Method Details

.value_from_string(string) ⇒ String

Return the String parameter as-is

Returns:

  • (String)


199
200
201
# File 'lib/nose/model/fields.rb', line 199

def self.value_from_string(string)
  string
end

Instance Method Details

#random_valueString

A random string of the correct length

Returns:

  • (String)


205
206
207
# File 'lib/nose/model/fields.rb', line 205

def random_value
  Faker::Lorem.characters(@size)
end