Class: KDoc::Container

Inherits:
Object
  • Object
show all
Includes:
BlockProcessor, Datum, Guarded, Taggable, KLog::Logging
Defined in:
lib/k_doc/container.rb

Overview

A container acts a base data object for any data that requires tagging such as unique key, type and namespace.

Direct Known Subclasses

Action, CsvDoc, JsonDoc, Model, YamlDoc

Instance Attribute Summary collapse

Attributes included from BlockProcessor

#block

Attributes included from Datum

#data

Attributes included from Taggable

#tag_options

Instance Method Summary collapse

Methods included from BlockProcessor

#eval_block, #execute_block, #initialize_block, #run_on_action

Methods included from Datum

#clear_data, #initialize_data, #set_data

Methods included from Guarded

#clear_errors, #error_hash, #error_messages, #errors, #guard, #log_any_messages, #valid?, #warn

Methods included from Taggable

#initialize_tag, #key, #namespace, #project, #tag, #type

Constructor Details

#initialize(**opts, &block) ⇒ Container

Returns a new instance of Container.



22
23
24
25
26
27
28
# File 'lib/k_doc/container.rb', line 22

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

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

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



13
14
15
# File 'lib/k_doc/container.rb', line 13

def opts
  @opts
end

#ownerObject

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



16
17
18
# File 'lib/k_doc/container.rb', line 16

def owner
  @owner
end

Instance Method Details

#debugObject



38
39
40
41
# File 'lib/k_doc/container.rb', line 38

def debug
  debug_container
  debug_errors
end

#default_container_typeObject



30
31
32
# File 'lib/k_doc/container.rb', line 30

def default_container_type
  :container
end

#default_data_typeObject



34
35
36
# File 'lib/k_doc/container.rb', line 34

def default_data_type
  @default_data_type ||= Hash
end

#owned?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/k_doc/container.rb', line 18

def owned?
  @owner != nil
end