Sha256: 82570c51a18a5bf11fbc9d22fe2bcb6a92ea20cfb1dab803e042c9c4c31418dd

Contents?: true

Size: 352 Bytes

Versions: 2

Compression:

Stored size: 352 Bytes

Contents

module Enabler
  class Rule

    attr_reader :feature, :definition

    def initialize(feature, definition)
      @feature, @definition = feature, definition
    end

    def enabled?(model)
      definition.call(model)
    end

    def self.find feature
      ::Enabler.config.rules.select { |item| item.feature == feature.to_sym }
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
enabler-0.0.5 lib/enabler/rule.rb
enabler-0.0.4 lib/enabler/rule.rb