lib/biggs.rb in biggs-0.4.0 vs lib/biggs.rb in biggs-0.5.0

- old
+ new

@@ -1,19 +1,16 @@ +require 'active_support' require 'biggs/format' require 'biggs/formatter' +require 'biggs/concern' require 'yaml' module Biggs - class << self - def formats - @@formats ||= YAML.load_file(File.join(File.dirname(__FILE__), '..', 'formats.yml')) || {} - end + FORMATS = (YAML.load_file(File.join(File.dirname(__FILE__), '..', 'formats.yml')) || {}).freeze + COUNTRY_NAMES = (YAML.load_file(File.join(File.dirname(__FILE__), '..', 'country_names.yml')) || {}).freeze - def country_names - @@country_names ||= YAML.load_file(File.join(File.dirname(__FILE__), '..', 'country_names.yml')) || {} - end - end -end + extend ActiveSupport::Concern -if defined?(ActiveRecord) and defined?(ActiveRecord::Base) and !ActiveRecord::Base.respond_to?(:biggs_formatter) - require 'biggs/activerecord' + included do + include Biggs::Concern + end end