Module: RBS::Types::Application

Included in:
Alias, ClassInstance, Interface
Defined in:
lib/rbs/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



207
208
209
# File 'lib/rbs/types.rb', line 207

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



206
207
208
# File 'lib/rbs/types.rb', line 206

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



209
210
211
# File 'lib/rbs/types.rb', line 209

def ==(other)
  other.is_a?(self.class) && other.name == name && other.args == args
end

#each_type(&block) ⇒ Object



235
236
237
238
239
240
241
# File 'lib/rbs/types.rb', line 235

def each_type(&block)
  if block
    args.each(&block)
  else
    enum_for :each_type
  end
end

#free_variables(set = Set.new) ⇒ Object



219
220
221
222
223
224
225
# File 'lib/rbs/types.rb', line 219

def free_variables(set = Set.new)
  set.tap do
    args.each do |arg|
      arg.free_variables(set)
    end
  end
end

#hashObject



215
216
217
# File 'lib/rbs/types.rb', line 215

def hash
  self.class.hash ^ name.hash ^ args.hash
end

#to_s(level = 0) ⇒ Object



227
228
229
230
231
232
233
# File 'lib/rbs/types.rb', line 227

def to_s(level = 0)
  if args.empty?
    name.to_s
  else
    "#{name}[#{args.join(", ")}]"
  end
end