Class: FeatureHub::Sdk::ServerEvalFeatureContext
- Inherits:
-
ClientContext
- Object
- ClientContext
- FeatureHub::Sdk::ServerEvalFeatureContext
- Defined in:
- lib/feature_hub/sdk/context.rb
Overview
context used when evaluating server side
Constant Summary
Constants inherited from ClientContext
ClientContext::WELL_KNOWN_KEY_METHODS
Instance Attribute Summary
Attributes inherited from ClientContext
Instance Method Summary collapse
- #build ⇒ Object
- #build_sync ⇒ Object
-
#initialize(repo, edge) ⇒ ServerEvalFeatureContext
constructor
A new instance of ServerEvalFeatureContext.
Methods inherited from ClientContext
#assign, #attribute_value, #boolean, #clear, #country, #default_percentage_key, #device, #enabled?, #exists?, #feature, #flag, #get_attr, #json, #number, #platform, #raw_json, #session_key, #set?, #string, #user_key, #version
Constructor Details
#initialize(repo, edge) ⇒ ServerEvalFeatureContext
Returns a new instance of ServerEvalFeatureContext.
185 186 187 188 189 190 |
# File 'lib/feature_hub/sdk/context.rb', line 185 def initialize(repo, edge) super(repo) @edge = edge @old_header = nil end |
Instance Method Details
#build ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/feature_hub/sdk/context.rb', line 192 def build return self unless @edge new_header = @attributes.map { |k, v| "#{k}=#{URI.encode_www_form_component(v[0].to_s)}" } * "&" if @old_header.nil? && new_header.empty? @edge.poll elsif new_header != @old_header @old_header = new_header @repo.not_ready! @edge.context_change(new_header) end self end |
#build_sync ⇒ Object
209 210 211 |
# File 'lib/feature_hub/sdk/context.rb', line 209 def build_sync build end |