Sha256: 689748133181864f268835c7f14c9aa507940eedaa211a5251577c40f8e0dc42
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
module Meta2 module Strategies class I18n include Meta2::Strategies FAILURE_KEYWORD = '___failure_keyword___' def detect absorber = Meta2::Absorber.new absorber.formats = formats absorber.defaults = catch_path :defaults if absorber.defaults.blank? absorber.defaults = Hash.new absorber.parts = Hash.new return absorber end retrieve_parts do |path| parts = ::I18n.t path, default: FAILURE_KEYWORD FAILURE_KEYWORD == parts.to_s ? nil : (absorber.parts = parts) end absorber.parts ||= Hash.new absorber end private def catch_path(namespace) path = "#{@config.assign_name}.config.#{namespace}" Meta2.debug "#{namespace} path:#{path}" content = ::I18n.t path, default: FAILURE_KEYWORD FAILURE_KEYWORD == content.to_s ? nil : content end def formats if @formats.present? @formats else _formats = catch_path(:formats).presence || Hash.new Hash[*default_formats.flatten].merge _formats end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
meta2-0.0.3 | lib/meta2/strategies/i18n.rb |
meta2-0.0.2 | lib/meta2/strategies/i18n.rb |