Module: RBS::Types::Application

Included in:
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.



200
201
202
# File 'lib/rbs/types.rb', line 200

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



199
200
201
# File 'lib/rbs/types.rb', line 199

def name
  @name
end

Instance Method Details

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



202
203
204
# File 'lib/rbs/types.rb', line 202

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

#each_type(&block) ⇒ Object



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

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

#free_variables(set = Set.new) ⇒ Object



212
213
214
215
216
217
218
# File 'lib/rbs/types.rb', line 212

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

#hashObject



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

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

#to_s(level = 0) ⇒ Object



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

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