class FlipFab::FeaturesByName

Public Class Methods

new(features_by_name = {}) click to toggle source
# File lib/flip_fab/features_by_name.rb, line 7
def initialize(features_by_name = {})
  @features_by_name = features_by_name
end

Public Instance Methods

[](name) click to toggle source
# File lib/flip_fab/features_by_name.rb, line 11
def [](name)
  raise "no feature has been defined with the name: #{name}" if @features_by_name[name].nil?

  @features_by_name[name]
end
with_context(context) click to toggle source
# File lib/flip_fab/features_by_name.rb, line 17
def with_context(context)
  FeaturesByName.new Hash[@features_by_name.map { |name, feature| [name, (feature.with_context context)] }]
end