Class: MiniRuby::CallInfo

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/miniruby/call_info.rb

Overview

Contains details about a function call like the name of the called function and the number of arguments.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, arg_count:) ⇒ CallInfo

: (name: Symbol, arg_count: Integer) -> void



17
18
19
20
# File 'lib/miniruby/call_info.rb', line 17

def initialize(name:, arg_count:)
  @name = name
  @arg_count = arg_count
end

Instance Attribute Details

#arg_countObject (readonly)

: Integer



14
15
16
# File 'lib/miniruby/call_info.rb', line 14

def arg_count
  @arg_count
end

#nameObject (readonly)

: Symbol



11
12
13
# File 'lib/miniruby/call_info.rb', line 11

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object

: (Object other) -> bool



23
24
25
26
27
# File 'lib/miniruby/call_info.rb', line 23

def ==(other)
  return false unless other.is_a?(CallInfo)

  @name == other.name && @arg_count == other.arg_count
end