Module: KDoc::BlockProcessor
- Included in:
- Container
- Defined in:
- lib/k_doc/mixins/block_processor.rb
Overview
A container acts a base data object for any data that requires tagging such as unique key, type and namespace. Rename: BlockProcessor
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
Instance Method Summary collapse
- #eval_block ⇒ Object
- #execute_block(run_actions: nil) ⇒ Object
- #initialize_block(_opts, &block) ⇒ Object
- #run_on_action ⇒ Object
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
8 9 10 |
# File 'lib/k_doc/mixins/block_processor.rb', line 8 def block @block end |
Instance Method Details
#eval_block ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/k_doc/mixins/block_processor.rb', line 19 def eval_block return if @block.nil? instance_eval(&@block) rescue StandardError => e log.error('Standard error in document') # puts "key #{unique_key}" # puts "file #{KUtil.data.console_file_hyperlink(resource.file, resource.file)}" log.error(e.) @error = e raise end |
#execute_block(run_actions: nil) ⇒ Object
14 15 16 17 |
# File 'lib/k_doc/mixins/block_processor.rb', line 14 def execute_block(run_actions: nil) eval_block run_on_action if run_actions end |
#initialize_block(_opts, &block) ⇒ Object
10 11 12 |
# File 'lib/k_doc/mixins/block_processor.rb', line 10 def initialize_block(_opts, &block) @block = block if block_given? end |
#run_on_action ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/k_doc/mixins/block_processor.rb', line 32 def run_on_action return if @block.nil? on_action if respond_to?(:on_action) rescue StandardError => e log.error('Standard error while running actions') # puts "key #{unique_key}" # puts "file #{KUtil.data.console_file_hyperlink(resource.file, resource.file)}" log.error(e.) @error = e raise end |