Class: RBSProtobuf::Name::Alias

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs_protobuf/name.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Alias

Returns a new instance of Alias.



37
38
39
40
# File 'lib/rbs_protobuf/name.rb', line 37

def initialize(name)
  raise unless name.alias?
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



35
36
37
# File 'lib/rbs_protobuf/name.rb', line 35

def name
  @name
end

Instance Method Details

#[](*args) ⇒ Object



42
43
44
# File 'lib/rbs_protobuf/name.rb', line 42

def [](*args)
  RBS::Types::Alias.new(name: name, args: args, location: nil)
end

#type?(t) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/rbs_protobuf/name.rb', line 46

def type?(t)
  t.is_a?(RBS::Types::Alias) && t.name == name
end