Class: TestIds::Configuration
- Inherits:
-
Object
- Object
- TestIds::Configuration
- Defined in:
- lib/test_ids/configuration.rb
Defined Under Namespace
Classes: Item
Instance Attribute Summary collapse
-
#allocator ⇒ Object
readonly
Returns the value of attribute allocator.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #bins(options = {}, &block) ⇒ Object
-
#bins=(val) ⇒ Object
An alias for config.bins.algorithm=.
- #empty? ⇒ Boolean
- #freeze ⇒ Object
-
#initialize(id) ⇒ Configuration
constructor
A new instance of Configuration.
- #load_from_serialized(store) ⇒ Object private
- #numbers(options = {}, &block) ⇒ Object
-
#numbers=(val) ⇒ Object
An alias for config.numbers.algorithm=.
- #send_to_ate=(val) ⇒ Object
- #send_to_ate? ⇒ Boolean
- #softbins(options = {}, &block) ⇒ Object
-
#softbins=(val) ⇒ Object
An alias for config.softbins.algorithm=.
- #to_json(*a) ⇒ Object
- #unique_by_flow=(val) ⇒ Object
- #unique_by_flow? ⇒ Boolean
- #validate! ⇒ Object
- #validated? ⇒ Boolean
Constructor Details
#initialize(id) ⇒ Configuration
Returns a new instance of Configuration.
91 92 93 94 |
# File 'lib/test_ids/configuration.rb', line 91 def initialize(id) @id = id @allocator = Allocator.new(self) end |
Instance Attribute Details
#allocator ⇒ Object (readonly)
Returns the value of attribute allocator.
89 90 91 |
# File 'lib/test_ids/configuration.rb', line 89 def allocator @allocator end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
89 90 91 |
# File 'lib/test_ids/configuration.rb', line 89 def id @id end |
Instance Method Details
#bins(options = {}, &block) ⇒ Object
96 97 98 99 100 |
# File 'lib/test_ids/configuration.rb', line 96 def bins( = {}, &block) @bins ||= Item.new @bins.callback(, &block) if block_given? @bins end |
#bins=(val) ⇒ Object
An alias for config.bins.algorithm=
103 104 105 |
# File 'lib/test_ids/configuration.rb', line 103 def bins=(val) bins.algorithm = val end |
#empty? ⇒ Boolean
152 153 154 |
# File 'lib/test_ids/configuration.rb', line 152 def empty? bins.empty? && softbins.empty? && numbers.empty? end |
#freeze ⇒ Object
160 161 162 163 164 165 |
# File 'lib/test_ids/configuration.rb', line 160 def freeze bins.freeze softbins.freeze numbers.freeze super end |
#load_from_serialized(store) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
176 177 178 179 180 |
# File 'lib/test_ids/configuration.rb', line 176 def load_from_serialized(store) bins.load_from_serialized(store['bins']) softbins.load_from_serialized(store['softbins']) numbers.load_from_serialized(store['numbers']) end |
#numbers(options = {}, &block) ⇒ Object
118 119 120 121 122 |
# File 'lib/test_ids/configuration.rb', line 118 def numbers( = {}, &block) @numbers ||= Item.new @numbers.callback(, &block) if block_given? @numbers end |
#numbers=(val) ⇒ Object
An alias for config.numbers.algorithm=
125 126 127 |
# File 'lib/test_ids/configuration.rb', line 125 def numbers=(val) numbers.algorithm = val end |
#send_to_ate=(val) ⇒ Object
129 130 131 |
# File 'lib/test_ids/configuration.rb', line 129 def send_to_ate=(val) @send_to_ate = !!val end |
#send_to_ate? ⇒ Boolean
133 134 135 |
# File 'lib/test_ids/configuration.rb', line 133 def send_to_ate? defined?(@send_to_ate) ? @send_to_ate : true end |
#softbins(options = {}, &block) ⇒ Object
107 108 109 110 111 |
# File 'lib/test_ids/configuration.rb', line 107 def softbins( = {}, &block) @softbins ||= Item.new @softbins.callback(, &block) if block_given? @softbins end |
#softbins=(val) ⇒ Object
An alias for config.softbins.algorithm=
114 115 116 |
# File 'lib/test_ids/configuration.rb', line 114 def softbins=(val) softbins.algorithm = val end |
#to_json(*a) ⇒ Object
167 168 169 170 171 172 173 |
# File 'lib/test_ids/configuration.rb', line 167 def to_json(*a) { 'bins' => bins, 'softbins' => softbins, 'numbers' => numbers }.to_json(*a) end |
#unique_by_flow=(val) ⇒ Object
137 138 139 |
# File 'lib/test_ids/configuration.rb', line 137 def unique_by_flow=(val) @unique_by_flow = !!val end |
#unique_by_flow? ⇒ Boolean
141 142 143 |
# File 'lib/test_ids/configuration.rb', line 141 def unique_by_flow? @unique_by_flow || false end |
#validate! ⇒ Object
145 146 147 148 149 150 |
# File 'lib/test_ids/configuration.rb', line 145 def validate! return if validated? @validated = true freeze end |
#validated? ⇒ Boolean
156 157 158 |
# File 'lib/test_ids/configuration.rb', line 156 def validated? @validated end |