Class: LaunchDarkly::Impl::Model::Clause
- Inherits:
-
Object
- Object
- LaunchDarkly::Impl::Model::Clause
- Defined in:
- lib/ldclient-rb/impl/model/clause.rb
Overview
Instance Attribute Summary collapse
- #attribute ⇒ LaunchDarkly::Reference readonly
- #context_kind ⇒ String|nil readonly
- #data ⇒ Hash readonly
- #negate ⇒ Boolean readonly
- #op ⇒ Symbol readonly
- #values ⇒ Array readonly
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(data, logger) ⇒ Clause
constructor
A new instance of Clause.
Constructor Details
#initialize(data, logger) ⇒ Clause
Returns a new instance of Clause.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 8 def initialize(data, logger) @data = data @context_kind = data[:contextKind] @attribute = (@context_kind.nil? || @context_kind.empty?) ? Reference.create_literal(data[:attribute]) : Reference.create(data[:attribute]) unless logger.nil? || @attribute.error.nil? logger.error("[LDClient] Data inconsistency in feature flag: #{@attribute.error}") end @op = data[:op].to_sym @values = data[:values] || [] @negate = !!data[:negate] end |
Instance Attribute Details
#attribute ⇒ LaunchDarkly::Reference (readonly)
25 26 27 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 25 def attribute @attribute end |
#context_kind ⇒ String|nil (readonly)
23 24 25 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 23 def context_kind @context_kind end |
#data ⇒ Hash (readonly)
21 22 23 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 21 def data @data end |
#negate ⇒ Boolean (readonly)
31 32 33 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 31 def negate @negate end |
#op ⇒ Symbol (readonly)
27 28 29 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 27 def op @op end |
#values ⇒ Array (readonly)
29 30 31 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 29 def values @values end |
Instance Method Details
#as_json ⇒ Object
33 34 35 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 33 def as_json @data end |