Sha256: 7560923c26ab1e5ed26dfad2c2c812905346c53b376966ea9a44aaaf3c3e8963

Contents?: true

Size: 579 Bytes

Versions: 25

Compression:

Stored size: 579 Bytes

Contents

#!/usr/bin/env ruby

require 'utils'

inputs = ARGV.empty? ? STDIN : ARGV

inputs.each do |filename_linenumber|
  source_location = filename_linenumber.source_location
  lf = Tins::LinesFile.for_filename(source_location.filename, source_location.linenumber)
  if spaces = lf.match_backward(/^(\s*)def\s+(?:\S+?)(?:\(|\s*$)/)&.first
    line_number_begin = lf.line_number
    lf.match_forward(/^#{spaces}end/)
    line_number_end = lf.line_number
    line_number_begin.upto(line_number_end) do |line_number|
      lf.line_number = line_number
      puts lf.line
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
utils-0.60.1 bin/print_method
utils-0.60.0 bin/print_method
utils-0.59.2 bin/print_method
utils-0.59.1 bin/print_method
utils-0.59.0 bin/print_method
utils-0.58.0 bin/print_method
utils-0.57.1 bin/print_method
utils-0.57.0 bin/print_method
utils-0.56.1 bin/print_method
utils-0.56.0 bin/print_method
utils-0.55.0 bin/print_method
utils-0.54.1 bin/print_method
utils-0.54.0 bin/print_method
utils-0.53.1 bin/print_method
utils-0.53.0 bin/print_method
utils-0.52.1 bin/print_method
utils-0.52.0 bin/print_method
utils-0.51.1 bin/print_method
utils-0.51.0 bin/print_method
utils-0.50.0 bin/print_method