123456789_123456789_123456789_123456789_123456789_

Class: RBS::Types::Interface

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
self, Application
Inherits: Object
Defined in: lib/rbs/types.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(name:, args:, location:) ⇒ Interface

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 315

def initialize(name:, args:, location:)
  @name = name
  @args = args
  @location = location
end

Instance Attribute Details

#location (readonly)

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 311

attr_reader :location

Instance Method Details

#map_type(&block)

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 339

def map_type(&block)
  if block
    Interface.new(
      name: name,
      args: args.map {|type| yield type },
      location: location
    )
  else
    enum_for(:map_type)
  end
end

#map_type_name(&block)

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 331

def map_type_name(&block)
  Interface.new(
    name: yield(name, location, self),
    args: args.map {|type| type.map_type_name(&block) },
    location: location
  )
end

#sub(s)

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 325

def sub(s)
  self.class.new(name: name,
                 args: args.map {|ty| ty.sub(s) },
                 location: location)
end

#to_json(state = _ = nil)

[ GitHub ]

  
# File 'lib/rbs/types.rb', line 321

def to_json(state = _ = nil)
  { class: :interface, name: name, args: args, location: location }.to_json(state)
end