Sha256: 8d47507949c74d1ba38494002c715b4ff656f27324a9226ac68c97f70111ab20

Contents?: true

Size: 893 Bytes

Versions: 6

Compression:

Stored size: 893 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module Ehbrs
  module CookingBook
    class Build
      class BasePage < SimpleDelegator
        attr_reader :parent

        def initialize(parent, source_object)
          super(source_object)
          @parent = parent
        end

        def build
          target_path.write(target_content)
        end

        def href
          "#{target_basename}.html"
        end

        def target_path
          parent.target_dir.join(href)
        end

        def target_content
          erb_result('layout', ::Ehbrs::CookingBook::Build::BasePage)
        end

        def inner_content
          erb_result('inner', self.class)
        end

        def erb_result(template_basename, template_source = self)
          template_source.erb_template("#{template_basename}.html.erb", self)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ehbrs-tools-0.35.1 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.35.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.34.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.33.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.32.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.31.1 lib/ehbrs/cooking_book/build/base_page.rb