Files
graphify/tests/fixtures/sample.rb
T
hibinm a19b9e90ec fix(ruby): emit inherits edge for class superclass
`class Dog < Animal` exposes the base in the `superclass` field, but the
inheritance handler in `_extract_generic` had branches for
java/kotlin/c#/scala/cpp/php/swift/python and none for Ruby, so every Ruby
`inherits` edge was silently dropped (contains/methods/calls unaffected).

Add a Ruby branch that reads the `superclass` field, handling both a bare
`constant` (`< Animal`) and a `scope_resolution` (`< Foo::Bar` -> Bar).
Adds a subclass to the Ruby fixture and a regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 10:47:10 +01:00

34 lines
441 B
Ruby

require 'json'
require 'net/http'
class ApiClient
def initialize(base_url)
@base_url = base_url
end
def get(path)
fetch(path, 'GET')
end
def post(path, body)
fetch(path, 'POST')
end
private
def fetch(path, method)
uri = URI(@base_url + path)
Net::HTTP.get(uri)
end
end
class TimeoutApiClient < ApiClient
def fetch(path, method)
super
end
end
def parse_response(raw)
JSON.parse(raw)
end