Sha256: 46b31f7f6724adb301aa2174bbfca67258740e1753bf7797091ea08d69281801

Contents?: true

Size: 650 Bytes

Versions: 19

Compression:

Stored size: 650 Bytes

Contents

# -*- coding: utf-8 -*-
module RubyToBlock
  module Block
    class End < Base
      blocknize '^\s*end$', statement: true

      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
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
smalruby-editor-0.1.16-x86-mingw32 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.16 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.15-x86-mingw32 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.15 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.14-x86-mingw32 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.14 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.13-x86-mingw32 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.13 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.12-x86-mingw32 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.12 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.11-x86-mingw32 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.10-x86-mingw32 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.10 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.9-x86-mingw32 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.9 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.8-x86-mingw32 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.8 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.7-x86-mingw32 app/models/concerns/ruby_to_block/block/end.rb
smalruby-editor-0.1.7 app/models/concerns/ruby_to_block/block/end.rb