Class: FeatureFlagClient::FeatureCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/feature_flag_client/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_features) ⇒ FeatureCollection

Returns a new instance of FeatureCollection.



58
59
60
61
# File 'lib/feature_flag_client/client.rb', line 58

def initialize(_features)
  p _features
  @features = _features
end

Instance Attribute Details

#featuresObject (readonly)

Returns the value of attribute features.



56
57
58
# File 'lib/feature_flag_client/client.rb', line 56

def features
  @features
end

Instance Method Details

#feature(name) ⇒ Object



63
64
65
# File 'lib/feature_flag_client/client.rb', line 63

def feature(name)
  features[name]
end

#to_json(*_args) ⇒ Object



67
68
69
70
71
# File 'lib/feature_flag_client/client.rb', line 67

def to_json(*_args)
  features.keys.each_with_object({}) do |feature_name, result|
    result[feature_name] = feature(feature_name).marshal_dump
  end.to_json
end