Class: RBS::Types::Interface
- Inherits:
-
Object
- Object
- RBS::Types::Interface
show all
- Includes:
- Application
- Defined in:
- lib/rbs/types.rb
Instance Attribute Summary collapse
Attributes included from Application
#args, #name
Instance Method Summary
collapse
#==, #each_type, #free_variables, #hash, #to_s
Constructor Details
#initialize(name:, args:, location:) ⇒ Interface
Returns a new instance of Interface.
249
250
251
252
253
|
# File 'lib/rbs/types.rb', line 249
def initialize(name:, args:, location:)
@name = name
@args = args
@location = location
end
|
Instance Attribute Details
#location ⇒ Object
Returns the value of attribute location.
245
246
247
|
# File 'lib/rbs/types.rb', line 245
def location
@location
end
|
Instance Method Details
#map_type(&block) ⇒ Object
273
274
275
276
277
278
279
280
281
282
283
|
# File 'lib/rbs/types.rb', line 273
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) ⇒ Object
265
266
267
268
269
270
271
|
# File 'lib/rbs/types.rb', line 265
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) ⇒ Object
259
260
261
262
263
|
# File 'lib/rbs/types.rb', line 259
def sub(s)
self.class.new(name: name,
args: args.map {|ty| ty.sub(s) },
location: location)
end
|
#to_json(state = _ = nil) ⇒ Object
255
256
257
|
# File 'lib/rbs/types.rb', line 255
def to_json(state = _ = nil)
{ class: :interface, name: name, args: args, location: location }.to_json(state)
end
|