Class: KDoc::Container
- Inherits:
-
Object
- Object
- KDoc::Container
- 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.
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
OpenStruct to be populated with context data, this can be used inside the on_init.
-
#opts ⇒ Object
readonly
Opts that are passed to the container.
-
#owner ⇒ Object
TODO: Owner/Owned need to be in a module and tested.
Attributes included from BlockProcessor
#action_block, #block, #block_state, #children, #depend_on_tags, #dependents, #init_block
Attributes included from Datum
Attributes included from Taggable
Instance Method Summary collapse
- #debug ⇒ Object
- #default_container_type ⇒ Object
- #default_data_type ⇒ Object
-
#initialize(**opts, &block) ⇒ Container
constructor
A new instance of Container.
- #os(**opts) ⇒ Object
- #owned? ⇒ Boolean
Methods included from BlockProcessor
#action, #actioned?, #add_child, #block_execute, #children_evaluated?, #debug_block_processor, #depend_on, #dependencies_met?, #evaluated?, #execute_block, #fire_action, #fire_children, #fire_eval, #fire_init, #import, #import_data, #init, #initialize_block_processor, #initialized?, #new?, #resolve_dependency
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.
26 27 28 29 30 31 32 33 |
# File 'lib/k_doc/container.rb', line 26 def initialize(**opts, &block) @context = OpenStruct.new @opts = opts initialize_tag(opts) initialize_data(opts) initialize_block_processor(opts, &block) end |
Instance Attribute Details
#context ⇒ Object (readonly)
OpenStruct to be populated with context data, this can be used inside the on_init
14 15 16 |
# File 'lib/k_doc/container.rb', line 14 def context @context end |
#opts ⇒ Object (readonly)
Opts that are passed to the container. Some options will be removed when evaluated by different plugins (Taggable, BlockProcessor)
17 18 19 |
# File 'lib/k_doc/container.rb', line 17 def opts @opts end |
#owner ⇒ Object
TODO: Owner/Owned need to be in a module and tested
20 21 22 |
# File 'lib/k_doc/container.rb', line 20 def owner @owner end |
Instance Method Details
#debug ⇒ Object
47 48 49 50 51 |
# File 'lib/k_doc/container.rb', line 47 def debug debug_taggable debug_block_processor debug_errors end |
#default_container_type ⇒ Object
35 36 37 |
# File 'lib/k_doc/container.rb', line 35 def default_container_type :container end |
#default_data_type ⇒ Object
39 40 41 |
# File 'lib/k_doc/container.rb', line 39 def default_data_type @default_data_type ||= Hash end |
#os(**opts) ⇒ Object
43 44 45 |
# File 'lib/k_doc/container.rb', line 43 def os(**opts) OpenStruct.new(opts) end |
#owned? ⇒ Boolean
22 23 24 |
# File 'lib/k_doc/container.rb', line 22 def owned? @owner != nil end |