Skip to content

Instantly share code, notes, and snippets.

View kysnrm's full-sized avatar

MORIOKA Ryota kysnrm

View GitHub Profile
@ryz310
ryz310 / faucet.rb
Created September 28, 2019 08:47
昔の蛇口と現代の蛇口をオブジェクト指向で表現してみた。勉強会用資料。
class Water
attr_reader :temperature, :amount
def initialize(temperature:, amount:)
@temperature = temperature
@amount = amount
end
def +(other)
total_amount = self.amount + other.amount