mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
30 lines
295 B
Ruby
30 lines
295 B
Ruby
|
class CalcService2
|
||
|
def initialize(value = 0)
|
||
|
@value = value
|
||
|
end
|
||
|
|
||
|
def set(value)
|
||
|
@value = value
|
||
|
end
|
||
|
|
||
|
def get
|
||
|
@value
|
||
|
end
|
||
|
|
||
|
def +(rhs)
|
||
|
@value + rhs
|
||
|
end
|
||
|
|
||
|
def -(rhs)
|
||
|
@value - rhs
|
||
|
end
|
||
|
|
||
|
def *(rhs)
|
||
|
@value * rhs
|
||
|
end
|
||
|
|
||
|
def /(rhs)
|
||
|
@value / rhs
|
||
|
end
|
||
|
end
|