Class: DataAnon::Strategy::Field::RandomInteger

Inherits:
Object
  • Object
show all
Defined in:
lib/strategy/field/number/random_integer.rb

Overview

Generates random integer number between given two numbers. Default range is 0 to 100.

anonymize('Age').using FieldStrategy::RandomInteger.new(18,70)

Instance Method Summary collapse

Constructor Details

#initialize(from = 0, to = 100) ⇒ RandomInteger

Returns a new instance of RandomInteger.


12
13
14
15
16
# File 'lib/strategy/field/number/random_integer.rb', line 12

def initialize from = 0, to = 100
  @from = from
  @to = to

end

Instance Method Details

#anonymize(field) ⇒ Object


18
19
20
# File 'lib/strategy/field/number/random_integer.rb', line 18

def anonymize field
  DataAnon::Utils::RandomInt.generate(@from,@to)
end