Sha256: 575c1bfface19c796d2d8de73c4ac49eca9fa439a0ca0f60a8182dc9dfee928d
Contents?: true
Size: 704 Bytes
Versions: 4
Compression:
Stored size: 704 Bytes
Contents
# frozen_string_literal: true module Esse class IndexMapping FILENAMES = %w[mapping mappings].freeze def initialize(body: {}, paths: [], filenames: FILENAMES) @paths = Array(paths) @filenames = Array(filenames) @mappings = body end # This method will be overwrited when passing a block during the # mapping defination def to_h return @mappings unless @mappings.empty? from_template || @mappings end def body to_h end def empty? body.empty? end protected def from_template return if @paths.empty? loader = Esse::TemplateLoader.new(@paths) loader.read(*@filenames) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
esse-0.2.0 | lib/esse/index_mapping.rb |
esse-0.1.3 | lib/esse/index_mapping.rb |
esse-0.1.2 | lib/esse/index_mapping.rb |
esse-0.1.1 | lib/esse/index_mapping.rb |