class NoSE::Fields::IntegerField

Field holding an integer

Constants

TYPE

Integers are stored as integers

Public Class Methods

new(name, **options) click to toggle source
Calls superclass method NoSE::Fields::Field::new
# File lib/nose/model/fields.rb, line 131
def initialize(name, **options)
  super(name, 8, **options)
  @cardinality = 10
end
value_from_string(string) click to toggle source

Parse an Integer from the provided parameter @return [Integer]

# File lib/nose/model/fields.rb, line 138
def self.value_from_string(string)
  string.to_i
end

Public Instance Methods

random_value() click to toggle source

Random numbers up to the given size @return [Integer]

# File lib/nose/model/fields.rb, line 144
def random_value
  rand(@cardinality)
end