Class: RubyToBlock::Block::End
- Defined in:
- app/models/concerns/ruby_to_block/block/end.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#fields, #parent, #prev_sibling, #sibling, #statements, #values
Class Method Summary collapse
Methods inherited from Base
#[], #add_statement, #add_value, blocknize, indent?, #indent_level, inherited, #initialize, inline?, #inline?, #null?, priority, process_else, process_end, process_value_string, regexp, statement?, #to_xml, type, #type, value?
Constructor Details
This class inherits a constructor from RubyToBlock::Block::Base
Class Method Details
.process_match_data(md, context) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/models/concerns/ruby_to_block/block/end.rb', line 7 def self.process_match_data(md, context) ends_num = 1 context.lines.each do |l| md2 = Block.statement_regexp.match(l) type = md2.names.find { |n| md2[n.to_sym] } if type == 'end' ends_num += 1 elsif Block[type].indent? ends_num -= 1 end end if context.statement && ends_num <= context.statement_stack.length Block.process_end(context) else false end end |