Sha256: 959e188d9918acf5388033b25faf93fcd7dd4ea9afb67a1f72c35f800e2387dc

Contents?: true

Size: 898 Bytes

Versions: 2

Compression:

Stored size: 898 Bytes

Contents

# frozen_string_literal: true

module KDoc
  # A container acts a base data object for any data that requires tagging
  # such as unique key, type and namespace.
  class Container
    include KLog::Logging
    include KDoc::Guarded
    include KDoc::Taggable
    include KDoc::Datum
    include KDoc::BlockProcessor

    attr_reader :opts

    # TODO: Owner/Owned need to be in a module and tested
    attr_accessor :owner

    def owned?
      @owner != nil
    end

    def initialize(**opts, &block)
      @opts = opts

      initialize_tag(opts)
      initialize_data(opts)
      initialize_block(opts, &block)
    end

    def default_container_type
      :container
    end

    def default_data_type
      Hash
    end

    def debug
      debug_container
      debug_errors
    end

    private

    def debug_errors
      log.block(errors, title: 'errors') unless valid?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
k_doc-0.0.23 lib/k_doc/container.rb
k_doc-0.0.22 lib/k_doc/container.rb