Class: NoSE::Fields::StringField
- 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
-
.value_from_string(string) ⇒ String
Return the String parameter as-is.
Instance Method Summary collapse
-
#initialize(name, length = 10, **options) ⇒ StringField
constructor
A new instance of StringField.
-
#random_value ⇒ String
A random string of the correct length.
Methods inherited from Field
#*, #==, #cardinality, #hash, #id, #to_color, #to_s
Methods included from Supertype
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, **) super(name, length, **) end |
Class Method Details
.value_from_string(string) ⇒ String
Return the String parameter as-is
199 200 201 |
# File 'lib/nose/model/fields.rb', line 199 def self.value_from_string(string) string end |
Instance Method Details
#random_value ⇒ String
A random string of the correct length
205 206 207 |
# File 'lib/nose/model/fields.rb', line 205 def random_value Faker::Lorem.characters(@size) end |