Sha256: 9baaac18e383d499a04918e23b4fe13d8326bc364a33ddf6b1cc2680d65dfc37

Contents?: true

Size: 658 Bytes

Versions: 5

Compression:

Stored size: 658 Bytes

Contents

require 'active_support/core_ext/module/attribute_accessors'

module Valle
  module Configuration

    mattr_accessor :options

    self.options = {
      enabled: true, # gem is enabled by default
      exclude_models: nil, # selects all AR models by default
      exclude_attributes: nil, # adds validators to all attributes by default
    }

    def configure
      yield self
    end

    def enabled=(value)
      self.options[:enabled] = value
    end

    def exclude_models=(collection)
      self.options[:exclude_models] = collection
    end

    def exclude_attributes=(mapping)
      self.options[:exclude_attributes] = mapping
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
valle-1.1.2 lib/valle/configuration.rb
valle-1.1.1 lib/valle/configuration.rb
valle-1.1.0 lib/valle/configuration.rb
valle-1.0.1 lib/valle/configuration.rb
valle-1.0.0 lib/valle/configuration.rb