Class: RBS::Types::Interface
- Inherits:
-
Object
- Object
- RBS::Types::Interface
- 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:) ⇒ Interface
constructor
A new instance of Interface.
- #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:) ⇒ Interface
Returns a new instance of Interface.
242 243 244 245 246 |
# File 'lib/rbs/types.rb', line 242 def initialize(name:, args:, location:) @name = name @args = args @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
238 239 240 |
# File 'lib/rbs/types.rb', line 238 def location @location end |
Instance Method Details
#map_type_name(&block) ⇒ Object
258 259 260 261 262 263 264 |
# File 'lib/rbs/types.rb', line 258 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
252 253 254 255 256 |
# File 'lib/rbs/types.rb', line 252 def sub(s) self.class.new(name: name, args: args.map {|ty| ty.sub(s) }, location: location) end |
#to_json(state = _ = nil) ⇒ Object
248 249 250 |
# File 'lib/rbs/types.rb', line 248 def to_json(state = _ = nil) { class: :interface, name: name, args: args, location: location }.to_json(state) end |