Class: FeatureHub::Sdk::Impl::RolloutStrategyAttribute

Inherits:
Object
  • Object
show all
Defined in:
lib/feature_hub/sdk/impl/rollout_holders.rb

Overview

represents an individual attribute comparison

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attr) ⇒ RolloutStrategyAttribute

Returns a new instance of RolloutStrategyAttribute.



66
67
68
69
70
71
72
73
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 66

def initialize(attr)
  @attr = attr
  @id = @attr["id"]
  @conditional = RolloutStrategyAttributeCondition.new(@attr["conditional"])
  @field_name = @attr["fieldName"]
  @values = @attr["values"]
  @field_type = @attr["type"]
end

Instance Attribute Details

#conditionalObject (readonly)

Returns the value of attribute conditional.



64
65
66
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 64

def conditional
  @conditional
end

#field_nameObject (readonly)

Returns the value of attribute field_name.



64
65
66
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 64

def field_name
  @field_name
end

#field_typeObject (readonly)

Returns the value of attribute field_type.



64
65
66
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 64

def field_type
  @field_type
end

#idObject (readonly)

Returns the value of attribute id.



64
65
66
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 64

def id
  @id
end

#valuesObject (readonly)

Returns the value of attribute values.



64
65
66
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 64

def values
  @values
end

Instance Method Details

#float_valuesObject



75
76
77
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 75

def float_values
  @values.filter { |x| !x.nil? }.map(&:to_f)
end

#str_valuesObject



79
80
81
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 79

def str_values
  @values.filter { |x| !x.nil? }.map(&:to_s)
end

#to_sObject



83
84
85
86
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 83

def to_s
  "id: #{@id}, conditional: #{@conditional}, field_name: #{@field_name}, " \
    "values: #{@values}, field_type: #{field_type}"
end