Sha256: 1cb7b23db41124b59d295f238561ee5e23c7a019054eefb7a66c0e797a27c9cf

Contents?: true

Size: 492 Bytes

Versions: 14

Compression:

Stored size: 492 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

14 entries across 14 versions & 1 rubygems

Version Path
writefully-0.8.2 lib/writefully/indices.rb
writefully-0.8.1 lib/writefully/indices.rb
writefully-0.8.0 lib/writefully/indices.rb
writefully-0.7.1 lib/writefully/indices.rb
writefully-0.6.12 lib/writefully/indices.rb
writefully-0.6.11 lib/writefully/indices.rb
writefully-0.6.10 lib/writefully/indices.rb
writefully-0.6.9 lib/writefully/indices.rb
writefully-0.6.7 lib/writefully/indices.rb
writefully-0.6.6 lib/writefully/indices.rb
writefully-0.6.5 lib/writefully/indices.rb
writefully-0.6.4 lib/writefully/indices.rb
writefully-0.6.3 lib/writefully/indices.rb
writefully-0.6.2 lib/writefully/indices.rb