Class: DirtySeed::Assigners::Number

Inherits:
Assigner
  • Object
show all
Defined in:
lib/dirty_seed/assigners/number.rb

Overview

Draws an integer matching validators

Instance Attribute Summary collapse

Attributes inherited from Assigner

#attribute

Instance Method Summary collapse

Methods inherited from Assigner

#initialize

Constructor Details

This class inherits a constructor from DirtySeed::Assigners::Assigner

Instance Attribute Details

#maxObject (readonly)

Returns the value of attribute max.



7
8
9
# File 'lib/dirty_seed/assigners/number.rb', line 7

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



7
8
9
# File 'lib/dirty_seed/assigners/number.rb', line 7

def min
  @min
end

Instance Method Details

#valueInteger, Float

Returns an value matching all validators

Returns:



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dirty_seed/assigners/number.rb', line 11

def value
  unless min && max
    define_min_and_max
    adjust_values
  end
  faker_value(
    category: :Number,
    method: :between,
    options: { from: min, to: max }
  )
end