Sha256: 8bf2b4c268b5cf868a87ac7459ebd0962d227d7777f947a2abec0e4ace8863cd

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

require 'valle/configuration'

module Valle
  extend Configuration

  # core
  autoload :Manager, 'valle/manager'
  autoload :ValidationSetter, 'valle/validation_setter'

  # extensions
  module AbstractAdapter
    autoload :ColumnWrapper, 'valle/abstract_adapter/column_wrapper'
    autoload :AbstractColumn, 'valle/abstract_adapter/abstract_column'
    autoload :ByteLimitedColumn, 'valle/abstract_adapter/byte_limited_column'
    autoload :CharacterLimitedColumn, 'valle/abstract_adapter/character_limited_column'
    autoload :UnlimitedColumn, 'valle/abstract_adapter/unlimited_column'
  end

  # hooks
  autoload :Hooks, 'valle/hooks'

  class << self

    ##
    # Is gem enabled (true by default)
    #
    # @see Valle::Configuration
    #
    def enabled?
      options[:enabled]
    end

    ##
    # Can we process this model
    #
    # If the user turned gem on only for certain models,
    # we need to check whether the model is in the list.
    #
    # @param [String] model_name the model name
    # @see Valle::Configuration
    #
    def can_process_model?(model_name)
      options[:models].nil? ||
        options[:models].is_a?(Array) && options[:models].include?(model_name)
    end
  end
end

## if not using Railtie, call `Valle::Hooks.init` directly
require 'valle/railtie' if defined? Rails

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
valle-0.1.0 lib/valle.rb
valle-0.0.3 lib/valle.rb