Class: TestIds::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/test_ids/configuration.rb

Defined Under Namespace

Classes: Item

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#on_completionObject

Returns the value of attribute on_completion.



35
36
37
# File 'lib/test_ids/configuration.rb', line 35

def on_completion
  @on_completion
end

#repoObject

Returns the value of attribute repo.



34
35
36
# File 'lib/test_ids/configuration.rb', line 34

def repo
  @repo
end

Instance Method Details

#binsObject



48
49
50
# File 'lib/test_ids/configuration.rb', line 48

def bins
  @bins ||= Item.new
end

#empty?Boolean

Returns:



91
92
93
# File 'lib/test_ids/configuration.rb', line 91

def empty?
  bins.empty? && softbins.empty? && numbers.empty?
end

#freezeObject



99
100
101
102
103
104
# File 'lib/test_ids/configuration.rb', line 99

def freeze
  bins.freeze
  softbins.freeze
  numbers.freeze
  super
end

#numbers(&block) ⇒ Object



65
66
67
68
69
70
71
# File 'lib/test_ids/configuration.rb', line 65

def numbers(&block)
  @numbers ||= Item.new
  if block_given?
    @numbers.callback(&block)
  end
  @numbers
end

#numbers=(val) ⇒ Object

An alias for config.numbers.algorithm=



74
75
76
# File 'lib/test_ids/configuration.rb', line 74

def numbers=(val)
  numbers.algorithm = val
end

#softbinsObject



52
53
54
55
56
57
58
# File 'lib/test_ids/configuration.rb', line 52

def softbins
  @softbins ||= Item.new
  if block_given?
    @softbins.callback(&block)
  end
  @softbins
end

#softbins=(val) ⇒ Object

An alias for config.softbins.algorithm=



61
62
63
# File 'lib/test_ids/configuration.rb', line 61

def softbins=(val)
  softbins.algorithm = val
end

#validate!Object



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/test_ids/configuration.rb', line 78

def validate!
  unless validated?
    if bins.algorithm
      fail 'The TestIds bins configuration cannot be set to an algorithm, only a range set by bins.include and bins.exclude is permitted'
    end
    if bins.callback
      fail 'The TestIds bins configuration cannot be set by a callback, only a range set by bins.include and bins.exclude is permitted'
    end
    @validated = true
    freeze
  end
end

#validated?Boolean

Returns:



95
96
97
# File 'lib/test_ids/configuration.rb', line 95

def validated?
  @validated
end