Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions lib/decode/language/ruby/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,20 +202,7 @@ def walk_definitions(node, parent = nil, source = nil, &block)
if parent
if node.arguments
node.arguments.arguments.each do |arg|
mod_name = case arg.type
when :constant_read_node
# Qualify with enclosing namespace if available (e.g. Mixins::Greeting)
if parent.parent && parent.parent.respond_to?(:qualified_name)
"#{parent.parent.qualified_name}::#{arg.name}"
else
arg.name.to_s
end
when :constant_path_node
nested_name_for(arg)
else
# Skip unsupported argument types (e.g., dynamic expressions)
nil
end
mod_name = nested_name_for(arg)
if mod_name
case name
when :include
Expand Down
4 changes: 2 additions & 2 deletions test/decode/language/ruby/.fixtures/mixins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def hello

class Greeter
include Greeting
extend Greeting
prepend Greeting
extend Mixins::Greeting
prepend ::Mixins::Greeting
end
end
4 changes: 2 additions & 2 deletions test/decode/language/ruby/includes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
my_class = definitions.find{|d| d.is_a?(Decode::Language::Ruby::Class) && d.qualified_name == "Mixins::Greeter"}
expect(my_class).not.to be_nil

expect(my_class.includes).to be == ["Mixins::Greeting"]
expect(my_class.includes).to be == ["Greeting"]
expect(my_class.extends).to be == ["Mixins::Greeting"]
expect(my_class.prepends).to be == ["Mixins::Greeting"]
expect(my_class.prepends).to be == ["::Mixins::Greeting"]
end
end
Loading