Sha256: 736d05642d0f3cd8a146a4f3e3422edec77f01f9b2e0f41b675611806324c6b2
Contents?: true
Size: 670 Bytes
Versions: 30
Compression:
Stored size: 670 Bytes
Contents
# frozen_string_literal: true module Kitchen # A simple counting object # # hehe class Counter # Creates a new +Counter+ instance def initialize reset end # Increase the value of the counter # # @param by [Integer] the amount to increase by # def increment(by: 1) @value += by end # @!method inc # @see increment alias_method :inc, :increment # Returns the value of the counter # # @return [Integer] def get @value end # Reset the value of the counter # # @param to [Integer] the value to reset to def reset(to: 0) @value = to end end end
Version data entries
30 entries across 30 versions & 1 rubygems