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.



181
182
183
# File 'lib/rbs/types.rb', line 181

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



180
181
182
# File 'lib/rbs/types.rb', line 180

def name
  @name
end

Instance Method Details

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



183
184
185
# File 'lib/rbs/types.rb', line 183

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

#each_type(&block) ⇒ Object



209
210
211
212
213
214
215
# File 'lib/rbs/types.rb', line 209

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

#free_variables(set = Set.new) ⇒ Object



193
194
195
196
197
198
199
# File 'lib/rbs/types.rb', line 193

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

#hashObject



189
190
191
# File 'lib/rbs/types.rb', line 189

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

#to_s(level = 0) ⇒ Object



201
202
203
204
205
206
207
# File 'lib/rbs/types.rb', line 201

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