Exception: SplitIoClient::Split
- Inherits:
-
NoMethodError
- Object
- NoMethodError
- SplitIoClient::Split
- Defined in:
- lib/engine/parser/split.rb
Overview
acts as dto for a split structure
Instance Attribute Summary collapse
-
#data ⇒ Object
definition of the split.
Instance Method Summary collapse
- #conditions ⇒ Object
-
#empty? ⇒ boolean
True if the condition is empty false otherwise.
-
#initialize(split) ⇒ Split
constructor
A new instance of Split.
- #killed? ⇒ Boolean
- #name ⇒ Object
- #seed ⇒ Object
-
#set_conditions ⇒ object
converts the conditions data into an array of condition objects for this split.
- #status ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(split) ⇒ Split
Returns a new instance of Split.
12 13 14 15 |
# File 'lib/engine/parser/split.rb', line 12 def initialize(split) @data = split @conditions = set_conditions end |
Instance Attribute Details
#data ⇒ Object
definition of the split
10 11 12 |
# File 'lib/engine/parser/split.rb', line 10 def data @data end |
Instance Method Details
#conditions ⇒ Object
43 44 45 |
# File 'lib/engine/parser/split.rb', line 43 def conditions @conditions end |
#empty? ⇒ boolean
Returns true if the condition is empty false otherwise.
49 50 51 |
# File 'lib/engine/parser/split.rb', line 49 def empty? @data.empty? end |
#killed? ⇒ Boolean
37 38 39 |
# File 'lib/engine/parser/split.rb', line 37 def killed? @data[:killed] end |
#name ⇒ Object
19 20 21 |
# File 'lib/engine/parser/split.rb', line 19 def name @data[:name] end |
#seed ⇒ Object
25 26 27 |
# File 'lib/engine/parser/split.rb', line 25 def seed @data[:seed] end |
#set_conditions ⇒ object
converts the conditions data into an array of condition objects for this split
57 58 59 60 61 62 63 64 |
# File 'lib/engine/parser/split.rb', line 57 def set_conditions conditions_list = [] @data[:conditions].each do |c| condition = SplitIoClient::Condition.new(c) conditions_list << condition end conditions_list end |
#status ⇒ Object
31 32 33 |
# File 'lib/engine/parser/split.rb', line 31 def status @data[:status] end |
#to_h ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/engine/parser/split.rb', line 66 def to_h { name: name, seed: seed, status: status, killed: killed?, conditions: conditions } end |