Sha256: e898eaec4dc3f77638761fdf29341ebcea57f7c4b8e487e7aa5170c5a5f4f56a

Contents?: true

Size: 646 Bytes

Versions: 1

Compression:

Stored size: 646 Bytes

Contents

require 'yaml'

module Mayl
  # Public: This module is responsible for loading YAML files and converting
  # them to Locale objects.
  #
  # Example
  #
  #   Loader.load('config/locales')
  #   # => [#<Locale:...>, #<Locale:...>]
  #
  module Loader
    # Public: Maps a set of YAML files in a directory to Locale objects, to
    # work comfortably with them.
    #
    # path - The path under which to scan for YAML files.
    #
    # Returns an Array of Locale objects.
    def self.load(path)
      Dir[File.expand_path(path) << "/*.yml"].map { |filename|
        Locale.new filename, YAML.load(File.read(filename))
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mayl-0.0.1 lib/mayl/loader.rb