Sha256: 28044061a86917b9f3aa605dbe4c90eda4f9e2688da07d154586f6b128fee609

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'i18n'
require 'cupcakinator/version'
require 'cupcakinator/base'
require 'cupcakinator/config'
require 'cupcakinator/options'
require 'cupcakinator/errors'

# the purpose of cupcakinator is to provide an simple, flexible dynamic method to retrrieve configuration
# data for a class
# it provides this dynamic method as 'config' by default for both the class and any instances
# @example class Foo uses cupcakinator, see Cupcakinator::Base::cupcakinate
#   given config.yml:
#   bacon:
#     flavor: pork
#   meatball:
#     flavor:
#       - pork
#       - chicken
#   >> Foo.config
#   {"meatball"=>{"flavor"=>["chicken", "pork"]}}
#   >> Foo.config.meatball
#   {"flavor"=>["chicken", "pork"]}
module Cupcakinator

  unless @_i18n_initialized_for_cupcakinator
    locale_file = File.expand_path(File.join(File.dirname(__FILE__), '../config/locales.yml'))
    I18n.enforce_available_locales = false
    I18n.load_path << locale_file
    @_i18n_initialized_for_cupcakinator = true
  end

  def self.included(other)
    other.extend Cupcakinator::Base
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cupcakinator-1.1.2 lib/cupcakinator.rb
cupcakinator-1.1.1 lib/cupcakinator.rb
cupcakinator-1.1.0 lib/cupcakinator.rb