Class: RBSProtobuf::Name::Interface

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Interface

Returns a new instance of Interface.



54
55
56
57
# File 'lib/rbs_protobuf/name.rb', line 54

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



52
53
54
# File 'lib/rbs_protobuf/name.rb', line 52

def name
  @name
end

Instance Method Details

#[](*args) ⇒ Object



59
60
61
# File 'lib/rbs_protobuf/name.rb', line 59

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

#type?(t) ⇒ Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/rbs_protobuf/name.rb', line 63

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