class RBS::TypeName
Attributes
kind[R]
name[R]
namespace[R]
Public Class Methods
new(namespace:, name:)
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 7 def initialize(namespace:, name:) @namespace = namespace @name = name @kind = case name.to_s[0,1] when /[A-Z]/ :class when /[a-z]/ :alias when "_" :interface else # Defaults to :class :class end end
Public Instance Methods
==(other)
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 23 def ==(other) other.is_a?(self.class) && other.namespace == namespace && other.name == name end
Also aliased as: eql?
absolute!()
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 53 def absolute! self.class.new(namespace: namespace.absolute!, name: name) end
absolute?()
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 57 def absolute? namespace.absolute? end
alias?()
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 49 def alias? kind == :alias end
class?()
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 45 def class? kind == :class end
hash()
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 29 def hash self.class.hash ^ namespace.hash ^ name.hash end
interface?()
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 65 def interface? kind == :interface end
relative!()
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 61 def relative! self.class.new(namespace: namespace.relative!, name: name) end
to_json(state = _ = nil)
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 37 def to_json(state = _ = nil) to_s.to_json(state) end
to_namespace()
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 41 def to_namespace namespace.append(self.name) end
to_s()
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 33 def to_s "#{namespace.to_s}#{name}" end
with_prefix(namespace)
click to toggle source
# File rbs-1.4.0/lib/rbs/type_name.rb, line 69 def with_prefix(namespace) self.class.new(namespace: namespace + self.namespace, name: name) end