Skip to content

Instantly share code, notes, and snippets.

View hemalvarambhia's full-sized avatar
👨‍🔬

Hemal Varambhia hemalvarambhia

👨‍🔬
View GitHub Profile
@hemalvarambhia
hemalvarambhia / employees.rb
Created October 5, 2022 20:28
An Example of a Collection Object
class Employees
include Enumerable
def initialize(employees)
@employees = employees
end
def each &block
@employees.each &block
end
@hemalvarambhia
hemalvarambhia / complex_number.rb
Created October 5, 2022 20:30
An Example of a Very Basic Class
class ComplexNumber
def initialize(real, imaginary)
@real = real
@imaginary = imaginary
end
def to_s
"#{@real} + #{@imaginary}i"
end
end