Sha256: cea6b93c92262de2ae09784580b52fc71716a0887c257e38ba0f6b81f4eed54d
Contents?: true
Size: 1.41 KB
Versions: 7
Compression:
Stored size: 1.41 KB
Contents
module SplitIoClient # # acts as dto for a split structure # class Split < NoMethodError # # definition of the split # # @returns [object] split values attr_accessor :data def initialize(split) @data = split @conditions = set_conditions end # # @returns [string] name of the split def name @data[:name] end # # @returns [int] seed value of the split def seed @data[:seed] end # # @returns [string] status value of the split def status @data[:status] end # # @returns [string] killed value of the split def killed? @data[:killed] end # # @returns [object] array of condition objects for this split def conditions @conditions end # # @return [boolean] true if the condition is empty false otherwise def empty? @data.empty? end # # converts the conditions data into an array of condition objects for this split # # @return [object] array of condition objects def set_conditions conditions_list = [] @data[:conditions].each do |c| condition = SplitIoClient::Condition.new(c) conditions_list << condition end conditions_list end def to_h { name: name, seed: seed, status: status, killed: killed?, conditions: conditions } end end end
Version data entries
7 entries across 7 versions & 1 rubygems