Use OpenStruct for item

This commit is contained in:
Cyril Lepagnot 2017-09-26 10:09:34 +02:00
parent 0f683493b0
commit 4a7c5cef3f

View File

@ -1,13 +1,7 @@
class Item require 'ostruct'
attr_accessor :name, :sell_in, :quality
def initialize(name:, sell_in:, quality:) class Item < OpenStruct
@name = name def to_s
@sell_in = sell_in [name, sell_in, quality].join ', '
@quality = quality
end
def to_s()
"#{@name}, #{@sell_in}, #{@quality}"
end end
end end