So I could write it like this... I'm not sure it's clear what's happening at first glance, though.

```ruby
def resolve_constant(constant_name)
  node = Object
  resolved_constant = nil

  constant_name.split('::').each do |part|
    if node.const_defined?(part)
      node = resolved_constant = node.const_get(part)
    else
      break
    end
  end

  resolved_constant
end
```