Class: Flagsmith::Engine::Features::MultivariateStateValue
- Inherits:
-
Object
- Object
- Flagsmith::Engine::Features::MultivariateStateValue
- Defined in:
- lib/flagsmith/engine/features/models.rb
Overview
MultivariateFeatureStateValueModel
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#multivariate_feature_option ⇒ Object
readonly
Returns the value of attribute multivariate_feature_option.
-
#mv_fs_value_uuid ⇒ Object
readonly
Returns the value of attribute mv_fs_value_uuid.
-
#percentage_allocation ⇒ Object
readonly
Returns the value of attribute percentage_allocation.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(id:, multivariate_feature_option:, percentage_allocation:, mv_fs_value_uuid: SecureRandom.uuid) ⇒ MultivariateStateValue
constructor
A new instance of MultivariateStateValue.
Constructor Details
#initialize(id:, multivariate_feature_option:, percentage_allocation:, mv_fs_value_uuid: SecureRandom.uuid) ⇒ MultivariateStateValue
Returns a new instance of MultivariateStateValue.
134 135 136 137 138 139 |
# File 'lib/flagsmith/engine/features/models.rb', line 134 def initialize(id:, multivariate_feature_option:, percentage_allocation:, mv_fs_value_uuid: SecureRandom.uuid) @id = id @percentage_allocation = percentage_allocation @multivariate_feature_option = multivariate_feature_option @mv_fs_value_uuid = mv_fs_value_uuid end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
132 133 134 |
# File 'lib/flagsmith/engine/features/models.rb', line 132 def id @id end |
#multivariate_feature_option ⇒ Object (readonly)
Returns the value of attribute multivariate_feature_option.
132 133 134 |
# File 'lib/flagsmith/engine/features/models.rb', line 132 def multivariate_feature_option @multivariate_feature_option end |
#mv_fs_value_uuid ⇒ Object (readonly)
Returns the value of attribute mv_fs_value_uuid.
132 133 134 |
# File 'lib/flagsmith/engine/features/models.rb', line 132 def mv_fs_value_uuid @mv_fs_value_uuid end |
#percentage_allocation ⇒ Object (readonly)
Returns the value of attribute percentage_allocation.
132 133 134 |
# File 'lib/flagsmith/engine/features/models.rb', line 132 def percentage_allocation @percentage_allocation end |
Class Method Details
.build(json) ⇒ Object
152 153 154 155 156 157 |
# File 'lib/flagsmith/engine/features/models.rb', line 152 def build(json) new( **json.slice(:id, :percentage_allocation, :mv_fs_value_uuid) .merge(multivariate_feature_option: MultivariateOption.build(json[:multivariate_feature_option])) ) end |
Instance Method Details
#<=>(other) ⇒ Object
141 142 143 144 145 146 147 148 149 |
# File 'lib/flagsmith/engine/features/models.rb', line 141 def <=>(other) return false if other.nil? if !id.nil? && !other.id.nil? id - other.id else mv_fs_value_uuid <=> other.mv_fs_value_uuid end end |