You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
307 B

2 years ago
require_relative "instance"
module Lox
class LoxClass
attr_reader :name
2 years ago
def initialize(name, methods)
@name, @methods = name, methods
2 years ago
end
2 years ago
def find_method(name) = @methods[name]
2 years ago
def to_s = name
def call(interpreter, args) = Instance.new(self)
def arity = 0
end
end