Class: FeatureHub::Sdk::Impl::RolloutStrategyAttribute
- Inherits:
-
Object
- Object
- FeatureHub::Sdk::Impl::RolloutStrategyAttribute
- Defined in:
- lib/feature_hub/sdk/impl/rollout_holders.rb
Overview
represents an individual attribute comparison
Instance Attribute Summary collapse
-
#conditional ⇒ Object
readonly
Returns the value of attribute conditional.
-
#field_name ⇒ Object
readonly
Returns the value of attribute field_name.
-
#field_type ⇒ Object
readonly
Returns the value of attribute field_type.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #float_values ⇒ Object
-
#initialize(attr) ⇒ RolloutStrategyAttribute
constructor
A new instance of RolloutStrategyAttribute.
- #str_values ⇒ Object
- #to_s ⇒ Object
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
#conditional ⇒ Object (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_name ⇒ Object (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_type ⇒ Object (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 |
#id ⇒ Object (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 |
#values ⇒ Object (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_values ⇒ Object
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_values ⇒ Object
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_s ⇒ Object
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 |