a

Ruby code posted
created at 08 May 00:13

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class RevealingRefrences
  attr_reader :wheels

  def initialize(data)
    @wheels = wheelify(data)
  end

  def diameter
    wheels.map { |wheel| wheel.rim + (wheel.tire*2) }
  end

  Wheel = Struct.new(:rim, :tire)
  def wheelify(data)
    data.colect{ |d| Wheel.new(d[0], d[1]) }
  end
end
307 Bytes in 4 ms with coderay