mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
Created separate file for 'Item' class
This commit is contained in:
parent
d04e29c319
commit
55004bf856
13
ruby/item.rb
Normal file
13
ruby/item.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
class Item
|
||||||
|
attr_accessor :name, :sell_in, :quality
|
||||||
|
|
||||||
|
def initialize(name, sell_in, quality)
|
||||||
|
@name = name # Name of the item
|
||||||
|
@sell_in = sell_in # Number of days to sell the item
|
||||||
|
@quality = quality # Represents how valuable the item is
|
||||||
|
end
|
||||||
|
|
||||||
|
def to_s()
|
||||||
|
"#{@name}, #{@sell_in}, #{@quality}" # Representing the item's details as a string
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue
Block a user