class Flipper::Api::V1::Decorators::Actor

Attributes

actor[R]

Public: the actor and features.

features[R]

Public: the actor and features.

Public Class Methods

new(actor, features) click to toggle source
# File lib/flipper/api/v1/decorators/actor.rb, line 9
def initialize(actor, features)
  @actor = actor
  @features = features
end

Public Instance Methods

as_json() click to toggle source
# File lib/flipper/api/v1/decorators/actor.rb, line 14
def as_json
  {
    'flipper_id' => actor.flipper_id,
    'features' => features_data,
  }
end

Private Instance Methods

features_data() click to toggle source
# File lib/flipper/api/v1/decorators/actor.rb, line 23
def features_data
  features.each_with_object({}) do |feature, features_hash|
    features_hash[feature.name] = {
      'enabled' => feature.enabled?(actor),
    }
    features_hash
  end
end