diff --git a/lib/ripper-tags/parser.rb b/lib/ripper-tags/parser.rb index 505d355..c820376 100644 --- a/lib/ripper-tags/parser.rb +++ b/lib/ripper-tags/parser.rb @@ -220,7 +220,7 @@ def on_method_add_arg(call, args) method_name = args[1][1] end - [procedure, klass, method_name, access, line] + [procedure, klass, method_name, access, line] if method_name when "scope", "named_scope" scope_name = args[1][0] [:rails_def, :scope, scope_name, line] if scope_name diff --git a/test/test_ripper_tags.rb b/test/test_ripper_tags.rb index a4efff7..55df994 100644 --- a/test/test_ripper_tags.rb +++ b/test/test_ripper_tags.rb @@ -258,6 +258,17 @@ def def() end assert_equal('method', module_tags.find{ |t| t[:name] == 'def' }[:kind]) end + def test_dynamic_module_function + tags = extract(<<-RUBY) + module Airbrussh + ANSI_CODES.each do |name, code| + module_function(name) + end + end + RUBY + assert_equal ["Airbrussh"], tags.map { |t| t.fetch(:name) } + end + def test_extract_one_line_definition_access_by_symbol %w(private public protected).each do |visibility| tags = extract(<<-EOC)