Module: SeedPacket
- Defined in:
- lib/seed_packet.rb,
lib/seed_packet/version.rb,
lib/seed_packet/environment.rb
Defined Under Namespace
Classes: Environment
Constant Summary collapse
- VERSION =
'0.1.2'
Instance Attribute Summary collapse
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#factory_class ⇒ Object
Returns the value of attribute factory_class.
Instance Method Summary collapse
-
#initialize(environment: nil, factory_class: 'FactoryBot') ⇒ Object
rubocop:disable Metrics/LineLength.
- #sample ⇒ Object
- #scrub ⇒ Object
-
#seed ⇒ Object
rubocop:enable Metrics/LineLength.
Instance Attribute Details
#environment ⇒ Object
Returns the value of attribute environment.
8 9 10 |
# File 'lib/seed_packet.rb', line 8 def environment @environment end |
#factory_class ⇒ Object
Returns the value of attribute factory_class.
8 9 10 |
# File 'lib/seed_packet.rb', line 8 def factory_class @factory_class end |
Instance Method Details
#initialize(environment: nil, factory_class: 'FactoryBot') ⇒ Object
rubocop:disable Metrics/LineLength
12 13 14 15 16 |
# File 'lib/seed_packet.rb', line 12 def initialize(environment: nil, factory_class: 'FactoryBot') self.environment = environment ? Environment.new(environment) : nil self.factory_class = Object.const_get(factory_class) if self.environment.samples_allowed? end |
#sample ⇒ Object
23 24 25 |
# File 'lib/seed_packet.rb', line 23 def sample yield if environment.samples_allowed? end |
#scrub ⇒ Object
27 28 29 |
# File 'lib/seed_packet.rb', line 27 def scrub yield if environment.scrubbing_allowed? end |
#seed ⇒ Object
rubocop:enable Metrics/LineLength
19 20 21 |
# File 'lib/seed_packet.rb', line 19 def seed yield if environment.seeding_allowed? end |