Ruby - Functional Patterns in Ruby
What is the output of this Ruby code combining OOP and functional style?
class Counter
def initialize
@count = 0
end
def increment
@count += 1
end
def current
@count
end
end
counter = Counter.new
3.times { counter.increment }
puts counter.current