Class: RBS::Types::Alias
- Inherits:
-
Object
- Object
- RBS::Types::Alias
- Includes:
- Application
- Defined in:
- lib/rbs/types.rb
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Attributes included from Application
Instance Method Summary collapse
-
#initialize(name:, args:, location:) ⇒ Alias
constructor
A new instance of Alias.
- #map_type_name(&block) ⇒ Object
- #sub(s) ⇒ Object
- #to_json(state = _ = nil) ⇒ Object
Methods included from Application
#==, #each_type, #free_variables, #hash, #to_s
Constructor Details
#initialize(name:, args:, location:) ⇒ Alias
Returns a new instance of Alias.
301 302 303 304 305 |
# File 'lib/rbs/types.rb', line 301 def initialize(name:, args:, location:) @name = name @args = args @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
297 298 299 |
# File 'lib/rbs/types.rb', line 297 def location @location end |
Instance Method Details
#map_type_name(&block) ⇒ Object
315 316 317 318 319 320 321 |
# File 'lib/rbs/types.rb', line 315 def map_type_name(&block) Alias.new( name: yield(name, location, self), args: args.map {|arg| arg.map_type_name(&block) }, location: location ) end |
#sub(s) ⇒ Object
311 312 313 |
# File 'lib/rbs/types.rb', line 311 def sub(s) Alias.new(name: name, args: args.map {|ty| ty.sub(s) }, location: location) end |
#to_json(state = _ = nil) ⇒ Object
307 308 309 |
# File 'lib/rbs/types.rb', line 307 def to_json(state = _ = nil) { class: :alias, name: name, args: args, location: location }.to_json(state) end |