Class: DirtySeed::Assigners::Base
- Defined in:
- lib/dirty_seed/assigners/base.rb
Overview
Draws a value matching validators
Instance Attribute Summary
Attributes inherited from Assigner
Instance Method Summary collapse
-
#value ⇒ <?>
Returns a value depending on validators and attribute type It firstly check if value can be set relying to validators If not, it delegates to an assigner adapted to the attribute type.
Methods inherited from Assigner
Constructor Details
This class inherits a constructor from DirtySeed::Assigners::Assigner
Instance Method Details
#value ⇒ <?>
Returns a value depending on validators and attribute type
It firstly check if value can be set to validators
If not, it delegates to an assigner adapted to the attribute type
14 15 16 17 18 19 20 |
# File 'lib/dirty_seed/assigners/base.rb', line 14 def value return if absent? return .sample if .is_a? Array return rand() if .is_a? Range try_specific || adapted_assigner&.value end |