Sha256: 6abec85a01a51f748b4d1d23ae1957ac40b80b8fb44aeb352a8fcaa3be40b308

Contents?: true

Size: 485 Bytes

Versions: 12

Compression:

Stored size: 485 Bytes

Contents

module Writefully
  module Indices
    def self.build_from(modified)
      modified.map do |file_name|
        index_hash_from(index_name_from(remove_content_path(file_name)))
      end
    end

    def self.remove_content_path(file_name)
      file_name.split('/') - Writefully.options[:content].split('/')
    end

    def self.index_name_from(array)
      [:site, :resource, :slug].zip(array).flatten
    end

    def self.index_hash_from(array)
      Hash[*array]
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
writefully-0.5.1 lib/writefully/indices.rb
writefully-0.5.0 lib/writefully/indices.rb
writefully-0.4.10 lib/writefully/indices.rb
writefully-0.4.8 lib/writefully/indices.rb
writefully-0.4.7 lib/writefully/indices.rb
writefully-0.4.6 lib/writefully/indices.rb
writefully-0.4.5 lib/writefully/indices.rb
writefully-0.4.4 lib/writefully/indices.rb
writefully-0.4.2 lib/writefully/indices.rb
writefully-0.4.1 lib/writefully/indices.rb
writefully-0.4.0 lib/writefully/indices.rb
writefully-0.3.6 lib/writefully/indices.rb