Class: Blocks::BlockDefinition

Inherits:
OptionsSet show all
Defined in:
lib/blocks/builders/block_definition.rb

Constant Summary

Constants inherited from HashWithRenderStrategy

HashWithRenderStrategy::RENDERING_STRATEGIES, HashWithRenderStrategy::RENDER_WITH_BLOCK, HashWithRenderStrategy::RENDER_WITH_PARTIAL, HashWithRenderStrategy::RENDER_WITH_PROXY

Instance Attribute Summary collapse

Attributes inherited from OptionsSet

#default_options, #name

Attributes inherited from HashWithRenderStrategy

#render_strategy

Instance Method Summary collapse

Methods inherited from OptionsSet

#inspect, #render_strategy, #render_strategy_item, #renders_with_proxy?, #reverse_merge!

Methods inherited from HashWithRenderStrategy

#except, #extractable_options?, #nested_under_indifferent_access, #render_strategy_and_item, #render_strategy_item, #renders_with_proxy?, #reverse_merge!, #slice, #to_hash, #to_s

Constructor Details

#initializeBlockDefinition

Returns a new instance of BlockDefinition.



10
11
12
13
# File 'lib/blocks/builders/block_definition.rb', line 10

def initialize(*)
  self.hooks = Hash.new {|hash, key| hash[key] = [] }
  super
end

Instance Attribute Details

#anonymousObject

Returns the value of attribute anonymous.



5
6
7
# File 'lib/blocks/builders/block_definition.rb', line 5

def anonymous
  @anonymous
end

#hooksObject

Returns the value of attribute hooks.



5
6
7
# File 'lib/blocks/builders/block_definition.rb', line 5

def hooks
  @hooks
end

#skip_completelyObject

Returns the value of attribute skip_completely.



5
6
7
# File 'lib/blocks/builders/block_definition.rb', line 5

def skip_completely
  @skip_completely
end

#skip_contentObject

Returns the value of attribute skip_content.



5
6
7
# File 'lib/blocks/builders/block_definition.rb', line 5

def skip_content
  @skip_content
end

Instance Method Details

#hooks_for(hook_type, initialize_when_missing: false) ⇒ Object



28
29
30
# File 'lib/blocks/builders/block_definition.rb', line 28

def hooks_for(hook_type, initialize_when_missing: false)
  hooks[hook_type] if initialize_when_missing || hooks.key?(hook_type)
end

#hooks_present?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/blocks/builders/block_definition.rb', line 32

def hooks_present?
  hooks.present?
end

#skip(completely = false) ⇒ Object



15
16
17
18
# File 'lib/blocks/builders/block_definition.rb', line 15

def skip(completely=false)
  self.skip_content = true
  self.skip_completely = completely
end

#skip_completely?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/blocks/builders/block_definition.rb', line 24

def skip_completely?
  !!skip_completely
end

#skip_content?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/blocks/builders/block_definition.rb', line 20

def skip_content?
  !!skip_content
end