Class: Blocks::BlockDefinition
- Inherits:
-
OptionsSet
- Object
- HashWithIndifferentAccess
- OptionsSet
- Blocks::BlockDefinition
- Defined in:
- lib/blocks/builders/block_definition.rb
Instance Attribute Summary
Attributes inherited from OptionsSet
#default_options, #name, #runtime_options, #standard_options
Instance Method Summary collapse
- #hooks_for(hook_name) ⇒ Object
- #skip(completely = false) ⇒ Object
- #skip_completely? ⇒ Boolean
- #skip_content? ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from OptionsSet
#add_options, #current_render_strategy_and_item, #initialize, #initialize_copy, #inspect, #nested_under_indifferent_access, #render_strategies_and_items, #reset
Constructor Details
This class inherits a constructor from Blocks::OptionsSet
Instance Method Details
#hooks_for(hook_name) ⇒ Object
23 24 25 |
# File 'lib/blocks/builders/block_definition.rb', line 23 def hooks_for(hook_name) self.send("#{hook_name}_hooks") end |
#skip(completely = false) ⇒ Object
10 11 12 13 |
# File 'lib/blocks/builders/block_definition.rb', line 10 def skip(completely=false) self.skip_content = true self.skip_completely = completely end |
#skip_completely? ⇒ Boolean
19 20 21 |
# File 'lib/blocks/builders/block_definition.rb', line 19 def skip_completely? !!skip_completely end |
#skip_content? ⇒ Boolean
15 16 17 |
# File 'lib/blocks/builders/block_definition.rb', line 15 def skip_content? !!skip_content end |
#to_s ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/blocks/builders/block_definition.rb', line 41 def to_s description = [] description << super = [ , , ].detect(&:render_strategy) strategy = .try(:render_strategy) render_strategy_name = if strategy == HashWithRenderStrategy::RENDER_WITH_PROXY caller_id = .callers[HashWithRenderStrategy::RENDER_WITH_PROXY] "proxy block \"#{[strategy]}\"" elsif strategy == HashWithRenderStrategy::RENDER_WITH_BLOCK caller_id = .callers[HashWithRenderStrategy::RENDER_WITH_BLOCK] "block defined at #{[strategy].source_location}" elsif strategy == HashWithRenderStrategy::RENDER_WITH_PARTIAL caller_id = .callers[HashWithRenderStrategy::RENDER_WITH_PARTIAL] "partial \"#{[strategy]}\"" end if render_strategy_name description << "Renders with #{render_strategy_name} [#{caller_id}]" end description.join("\n") end |