Sha256: 23e3c06b35b5f0eb3123df8c0f482e93ca8cfeb268a01ca2e8f127a98e45c291

Contents?: true

Size: 1.18 KB

Versions: 35

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

require 'asciidoctor'
require 'eac_ruby_utils/core_ext'

module Avm
  module EacAsciidoctorBase0
    module Sources
      class Base
        class Document
          enable_simple_cache
          enable_speaker
          require_sub __FILE__, include_modules: true
          common_constructor :source, :parent_document, :basename

          # Absolute path to the Asciidoctor file.
          #
          # @return [Pathname]
          def body_path
            root_path.join(
              ::Avm::EacAsciidoctorBase0::Sources::Base::CONTENT_DOCUMENT_BASENAME
            )
          end

          # Absolute path to the document's source root.
          #
          # @return [Pathname]
          def root_path
            source.content_directory.join(subpath)
          end

          # @return [Pathname]
          def subpath
            parent_document.if_present('.'.to_pathname) { |pd| pd.subpath.join(basename) }
          end

          private

          def children_uncached
            root_path.children.select(&:directory?)
                     .map { |path| self.class.new(source, self, path.basename) }
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
eac_tools-0.58.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
avm-eac_asciidoctor_base0-0.16.0 lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.57.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.56.1 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.56.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.55.7 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.55.6 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.55.5 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.55.4 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.55.3 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.55.2 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.55.1 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.55.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.54.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
avm-eac_asciidoctor_base0-0.15.0 lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.53.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
avm-eac_asciidoctor_base0-0.14.0 lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.52.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.51.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.50.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb