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.0.5'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#environmentObject

Returns the value of attribute environment.



6
7
8
# File 'lib/seed_packet.rb', line 6

def environment
  @environment
end

#factory_classObject

Returns the value of attribute factory_class.



6
7
8
# File 'lib/seed_packet.rb', line 6

def factory_class
  @factory_class
end

Instance Method Details

#initialize(options = {}) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/seed_packet.rb', line 9

def initialize(options = {})
  self.environment   = options.key?(:environment) ? Environment.new(environment) : nil

  if environment.samples_allowed?
    self.factory_class = Object.const_get(options.fetch(:factory_class, 'FactoryGirl'))
  end
end

#sampleObject



23
24
25
26
27
# File 'lib/seed_packet.rb', line 23

def sample
  if environment.samples_allowed?
    yield
  end
end

#scrubObject



29
30
31
32
33
# File 'lib/seed_packet.rb', line 29

def scrub
  if environment.scrubbing_allowed?
    yield
  end
end

#seedObject



17
18
19
20
21
# File 'lib/seed_packet.rb', line 17

def seed
  if environment.seeding_allowed?
    yield
  end
end