Module: TestIds

Defined in:
lib/test_ids.rb,
lib/test_ids/git.rb,
lib/test_ids/allocator.rb,
lib/test_ids/bin_array.rb,
lib/test_ids/configuration.rb

Defined Under Namespace

Classes: Allocator, BinArray, Configuration, Git

Class Method Summary collapse

Class Method Details

.allocatorObject



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

def allocator
  unless @configuration
    fail 'The test ID generator has to be configured before you can start using it'
  end
  @allocator ||= Allocator.new
end

.configurationObject Also known as: config



36
37
38
39
40
41
42
43
44
45
# File 'lib/test_ids.rb', line 36

def configuration
  if block_given?
    configure do |config|
      yield config
    end
  else
    @configuration ||
      fail('You have to create the configuration first before you can access it')
  end
end

.configure {|@configuration| ... } ⇒ Object

Yields:



48
49
50
51
52
53
54
55
56
# File 'lib/test_ids.rb', line 48

def configure
  if @configuration
    fail "You can't modify an existing test IDs configuration"
  end
  @configuration = Configuration.new
  yield @configuration
  @configuration.validate!
  allocator.prepare
end

.storeObject



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

def store
  unless @configuration
    fail 'The test ID generator has to be configured before you can start using it'
  end
  @store ||= Store.new
end