Sha256: d833ecbf6e8b5364d29d03573f1c7f10737ef47e717e98e40a18bed1886732a1

Contents?: true

Size: 632 Bytes

Versions: 6

Compression:

Stored size: 632 Bytes

Contents

module Flipflop
  class FeatureDefinition
    attr_reader :key, :name, :title, :description, :default, :group, :location

    def initialize(key, **options)
      @key = key
      @name = @key.to_s.freeze
      @title = options.delete(:title).freeze || @name.humanize.freeze
      @description = options.delete(:description).freeze
      @default = !!options.delete(:default) || false
      @group = options.delete(:group).freeze
      @location = caller_locations(3, 1).first.freeze

      if options.any?
        raise FeatureError.new(name, "has unknown option #{options.keys.map(&:inspect) * ', '}")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
flipflop-2.8.0 lib/flipflop/feature_definition.rb
flipflop-2.7.1 lib/flipflop/feature_definition.rb
flipflop-2.7.0 lib/flipflop/feature_definition.rb
flipflop-2.6.0 lib/flipflop/feature_definition.rb
flipflop-2.5.0 lib/flipflop/feature_definition.rb
flipflop-2.4.0 lib/flipflop/feature_definition.rb