Sha256: f7f4f8fa46f25c2a7b35b8517fda1a7e6c9f15f772244662f83927616c12aada

Contents?: true

Size: 911 Bytes

Versions: 14

Compression:

Stored size: 911 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module EhbrsRubyUtils
  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', ::EhbrsRubyUtils::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

14 entries across 14 versions & 1 rubygems

Version Path
ehbrs_ruby_utils-0.44.3 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.44.2 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.44.1 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.44.0 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.41.1 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.41.0 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.40.0 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.39.0 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.38.0 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.37.0 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.36.1 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.36.0 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.35.0 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb
ehbrs_ruby_utils-0.33.0 lib/ehbrs_ruby_utils/cooking_book/build/base_page.rb