Class: RBS::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs/factory.rb

Instance Method Summary collapse

Instance Method Details

#type_name(string) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/rbs/factory.rb', line 3

def type_name(string)
  absolute = string.start_with?("::")

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

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