Sha256: 746c29665a2728cdd8eed9a28bd7f55fafc67e4eae9c24ddbdec20c3cd78d744

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

module Cavalry
  class Config
    # Defines validator definition path. files required with **/*.rb
    mattr_accessor :models_path

    # Defines validator definition path. files required with **/*.rb
    mattr_accessor :validators_path

    def load_models
      load_rb_files(models_path)
    end

    def load_validators
      load_rb_files(validators_path)
    end

    private

    def load_rb_files(path)
      return unless path
      files = Dir.glob(File.join("#{path}", "**/*.rb"))
      files.each { |f| require f }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cavalry-0.1.0 lib/cavalry/config.rb