Class: FeatureHub::Sdk::Impl::RolloutStrategy
- Inherits:
-
Object
- Object
- FeatureHub::Sdk::Impl::RolloutStrategy
- Defined in:
- lib/feature_hub/sdk/impl/rollout_holders.rb
Overview
represents a raw rollout strategy inside a feature
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#percentage ⇒ Object
readonly
Returns the value of attribute percentage.
-
#percentage_attributes ⇒ Object
readonly
Returns the value of attribute percentage_attributes.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #attributes? ⇒ Boolean
-
#initialize(strategy) ⇒ RolloutStrategy
constructor
A new instance of RolloutStrategy.
- #percentage_attributes? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(strategy) ⇒ RolloutStrategy
Returns a new instance of RolloutStrategy.
93 94 95 96 97 98 99 100 101 |
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 93 def initialize(strategy) @strategy = strategy @attributes = (strategy["attributes"] || []).map { |attr| RolloutStrategyAttribute.new(attr) } @id = strategy["id"] @name = strategy["name"] @percentage = (strategy["percentage"] || "0").to_i @percentage_attributes = (strategy["percentageAttributes"] || []) @value = strategy["value"] end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
91 92 93 |
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 91 def attributes @attributes end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
91 92 93 |
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 91 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
91 92 93 |
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 91 def name @name end |
#percentage ⇒ Object (readonly)
Returns the value of attribute percentage.
91 92 93 |
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 91 def percentage @percentage end |
#percentage_attributes ⇒ Object (readonly)
Returns the value of attribute percentage_attributes.
91 92 93 |
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 91 def percentage_attributes @percentage_attributes end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
91 92 93 |
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 91 def value @value end |
Instance Method Details
#attributes? ⇒ Boolean
107 108 109 |
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 107 def attributes? !@attributes.empty? end |
#percentage_attributes? ⇒ Boolean
103 104 105 |
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 103 def percentage_attributes? !@percentage_attributes.empty? end |
#to_s ⇒ Object
111 112 113 114 |
# File 'lib/feature_hub/sdk/impl/rollout_holders.rb', line 111 def to_s "id: #{@id}, name: #{@name}, percentage: #{@percentage}, percentage_attrs: #{@percentage_attributes}, " \ "value: #{@value}, attributes: [#{@attributes.map(&:to_s).join(",")}]" end |