Sha256: 8fda30c943902b384347bb315fbba002c437eb6b9ec526e6cd698bbcfae9ef1a

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 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?)
              .reject { |path| path.basename.to_path == MEDIA_DIRECTORY_BASENAME }
              .map { |path| self.class.new(source, self, path.basename) }
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
avm-eac_asciidoctor_base0-0.20.0 lib/avm/eac_asciidoctor_base0/sources/base/document.rb
eac_tools-0.83.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb