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, errors_out = nil) ⇒ Clause
constructor
A new instance of Clause.
Constructor Details
#initialize(data, errors_out = nil) ⇒ Clause
Returns a new instance of Clause.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 10 def initialize(data, errors_out = nil) @data = data @context_kind = data[:contextKind] @op = data[:op].to_sym if @op == :segmentMatch @attribute = nil else @attribute = (@context_kind.nil? || @context_kind.empty?) ? Reference.create_literal(data[:attribute]) : Reference.create(data[:attribute]) unless errors_out.nil? || @attribute.error.nil? errors_out << "clause has invalid attribute: #{@attribute.error}" end end @values = data[:values] || [] @negate = !!data[:negate] end |
Instance Attribute Details
#attribute ⇒ LaunchDarkly::Reference (readonly)
31 32 33 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 31 def attribute @attribute end |
#context_kind ⇒ String|nil (readonly)
29 30 31 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 29 def context_kind @context_kind end |
#data ⇒ Hash (readonly)
27 28 29 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 27 def data @data end |
#negate ⇒ Boolean (readonly)
37 38 39 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 37 def negate @negate end |
#op ⇒ Symbol (readonly)
33 34 35 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 33 def op @op end |
#values ⇒ Array (readonly)
35 36 37 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 35 def values @values end |
Instance Method Details
#as_json ⇒ Object
39 40 41 |
# File 'lib/ldclient-rb/impl/model/clause.rb', line 39 def as_json @data end |