Class: Schemacop::V2::NodeWithBlock
- Defined in:
- lib/schemacop/v2/node_with_block.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Node
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Node
build, class_matches?, clear_klasses, clear_symbols, #initialize, klass, option, #option, #option?, register, #resolve_type_klass, symbol, symbol_matches?, #type_filter_matches?, #type_label, type_matches?, #type_matches?, #validate
Constructor Details
This class inherits a constructor from Schemacop::V2::Node
Class Method Details
.block_method(name) ⇒ Object
6 7 8 |
# File 'lib/schemacop/v2/node_with_block.rb', line 6 def self.block_method(name) self.block_methods += [name] end |
Instance Method Details
#exec_block(&block) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/schemacop/v2/node_with_block.rb', line 10 def exec_block(&block) return unless block_given? se = Schemacop::ScopedEnv.new(self, self.class.block_methods) se.instance_exec(&block) end |