Class: Determinator::Context::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/determinator/context/resolver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(actors, controller, id_path, feature: nil) ⇒ Resolver

Returns a new instance of Resolver.



6
7
8
9
10
11
# File 'lib/determinator/context/resolver.rb', line 6

def initialize(actors, controller, id_path, feature: nil)
  @actors = actors
  @controller = controller
  @id_path = id_path
  @feature = feature
end

Instance Attribute Details

#actorsObject (readonly)

Returns the value of attribute actors.



4
5
6
# File 'lib/determinator/context/resolver.rb', line 4

def actors
  @actors
end

#id_pathObject (readonly)

Returns the value of attribute id_path.



4
5
6
# File 'lib/determinator/context/resolver.rb', line 4

def id_path
  @id_path
end

Instance Method Details

#feature_flag_on?(feature_name) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/determinator/context/resolver.rb', line 17

def feature_flag_on?(feature_name)
  controller.feature_flag_on?(feature_name, id: actors.get(id_path), properties: actors.to_params, feature: feature)
end

#which_variant(feature_name) ⇒ Object



13
14
15
# File 'lib/determinator/context/resolver.rb', line 13

def which_variant(feature_name)
  controller.which_variant(feature_name, id: actors.get(id_path), properties: actors.to_params, feature: feature)
end