Class: RBS::TypeName

Inherits:
Object
  • Object
show all
Defined in:
lib/orthoses/shims.rb

Class Method Summary collapse

Class Method Details

.parse(string) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/orthoses/shims.rb', line 5

def self.parse(string)
  absolute = string.start_with?("::")

  *path, name = string.delete_prefix("::").split("::").map(&:to_sym)
  raise unless name

  TypeName.new(
    name: name,
    namespace: RBS::Namespace.new(path: path, absolute: absolute)
  )
end