Class: RBS::Types::Interface
- Inherits:
-
Object
- Object
- RBS::Types::Interface
- Includes:
- Application, _TypeBase
- Defined in:
- lib/rbs/types.rb,
sig/types.rbs
Instance Attribute Summary collapse
-
#location ⇒ loc?
readonly
Returns the value of attribute location.
Attributes included from Application
Instance Method Summary collapse
-
#initialize(name:, args:, location:) ⇒ Interface
constructor
A new instance of Interface.
- #map_type {|arg0| ... } ⇒ Object
- #map_type_name(&block) ⇒ Object
- #sub(s) ⇒ Object
- #to_json(state = nil) ⇒ Object
Methods included from Application
#==, #each_type, #free_variables, #has_classish_type?, #has_self_type?, #hash, #to_s, #with_nonreturn_void?
Methods included from _TypeBase
#each_type, #free_variables, #has_classish_type?, #has_self_type?, #to_s, #with_nonreturn_void?
Constructor Details
#initialize(name:, args:, location:) ⇒ Interface
Returns a new instance of Interface.
327 328 329 330 331 |
# File 'lib/rbs/types.rb', line 327 def initialize(name:, args:, location:) @name = name @args = args @location = location end |
Instance Attribute Details
#location ⇒ loc? (readonly)
Returns the value of attribute location.
323 324 325 |
# File 'lib/rbs/types.rb', line 323 def location @location end |
Instance Method Details
#map_type ⇒ Interface #map_type ⇒ Enumerator[t, Interface]
353 354 355 356 357 358 359 360 361 362 363 |
# File 'lib/rbs/types.rb', line 353 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
345 346 347 348 349 350 351 |
# File 'lib/rbs/types.rb', line 345 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
337 338 339 340 341 342 343 |
# File 'lib/rbs/types.rb', line 337 def sub(s) return self if s.empty? self.class.new(name: name, args: args.map {|ty| ty.sub(s) }, location: location) end |
#to_json(state = nil) ⇒ Object
333 334 335 |
# File 'lib/rbs/types.rb', line 333 def to_json(state = nil) { class: :interface, name: name, args: args, location: location }.to_json(state) end |