Sha256: e4af967ca19eacb6e12cac6382756536ab9e2d2e8135abc1ae0a918d7f070dc8
Contents?: true
Size: 821 Bytes
Versions: 1
Compression:
Stored size: 821 Bytes
Contents
module Meta2 module Strategies attr_reader :options, :config, :formats def initialize(options) @options = options @config = Meta2.config end def detect raise "`detect` method Must be need to overriden" end protected def retrieve_parts @options[:prefixes].detect do |prefix| path = build_path prefix result = yield path Meta2.debug "part path:#{path} #{result ? 'hit' : 'miss'}" result end end def build_path(prefix) path_prefix = prefix.gsub '/', '.' '%s.parts.%s.%s' % [ @config.assign_name, path_prefix, @options[:template] ] end def default_formats hash = @config.columns.map do |column| [column, '%'] end Hash[*hash.flatten] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
meta2-0.0.1 | lib/meta2/strategies.rb |