В
Size: a a a
В
Э
eval("puts `rm -rf`") лучше будетVV
В
Э
def calculate(input)
input.match(/(\d+)([+\-*\/])(\d+)/)
$1.to_i.public_send($2, $3.to_i)
end
puts calculate('12+10')
puts calculate('11-2')
В
VV
Э
def calculate(input)
/(?<operand1>\d+)(?<operator>[+\-*\/])(?<operand2>\d+)/ =~ input
operand1.to_i.method(operator).call(operand2.to_i)
end
puts calculate('12+10')
puts calculate('11-2')
DM
DG
T

В
DM
DG

D

Э
Д
B
B
c