Sha256: 3899f5c25dc5240a9da13daa030b6512d1b606a19e3554fd7edeac4dd7c1da92

Contents?: true

Size: 937 Bytes

Versions: 20

Compression:

Stored size: 937 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'ehbrs/patches/object/erb_template'

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

20 entries across 20 versions & 1 rubygems

Version Path
ehbrs-tools-0.31.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.30.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.29.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.28.3 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.28.2 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.28.1 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.28.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.27.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.26.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.25.1 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.25.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.24.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.23.1 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.23.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.22.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.21.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.20.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.19.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.18.0 lib/ehbrs/cooking_book/build/base_page.rb
ehbrs-tools-0.17.0 lib/ehbrs/cooking_book/build/base_page.rb