mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-17 23:41:27 +00:00
Delete ruby directory
This commit is contained in:
parent
0f7e0affaa
commit
e4968f2a77
@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<buildpath>
|
|
||||||
<buildpathentry kind="src" path=""/>
|
|
||||||
<buildpathentry kind="con" path="org.eclipse.dltk.launching.INTERPRETER_CONTAINER"/>
|
|
||||||
</buildpath>
|
|
||||||
2
ruby/.gitignore
vendored
2
ruby/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
.idea
|
|
||||||
*.iml
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<loadpath>
|
|
||||||
<pathentry path="" type="src" />
|
|
||||||
<pathentry path="org.rubypeople.rdt.launching.RUBY_CONTAINER" type="con" />
|
|
||||||
</loadpath>
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>GildedRose.rb</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.rubypeople.rdt.core.rubybuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.dltk.core.scriptbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.rubypeople.rdt.core.rubynature</nature>
|
|
||||||
<nature>org.eclipse.dltk.ruby.core.nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
--colour
|
|
||||||
--format documentation
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
class GildedRose
|
|
||||||
|
|
||||||
def initialize(items)
|
|
||||||
@items = items
|
|
||||||
end
|
|
||||||
|
|
||||||
def update_quality()
|
|
||||||
@items.each do |item|
|
|
||||||
if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert"
|
|
||||||
if item.quality > 0
|
|
||||||
if item.name != "Sulfuras, Hand of Ragnaros"
|
|
||||||
item.quality = item.quality - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if item.quality < 50
|
|
||||||
item.quality = item.quality + 1
|
|
||||||
if item.name == "Backstage passes to a TAFKAL80ETC concert"
|
|
||||||
if item.sell_in < 11
|
|
||||||
if item.quality < 50
|
|
||||||
item.quality = item.quality + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if item.sell_in < 6
|
|
||||||
if item.quality < 50
|
|
||||||
item.quality = item.quality + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if item.name != "Sulfuras, Hand of Ragnaros"
|
|
||||||
item.sell_in = item.sell_in - 1
|
|
||||||
end
|
|
||||||
if item.sell_in < 0
|
|
||||||
if item.name != "Aged Brie"
|
|
||||||
if item.name != "Backstage passes to a TAFKAL80ETC concert"
|
|
||||||
if item.quality > 0
|
|
||||||
if item.name != "Sulfuras, Hand of Ragnaros"
|
|
||||||
item.quality = item.quality - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
item.quality = item.quality - item.quality
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if item.quality < 50
|
|
||||||
item.quality = item.quality + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Item
|
|
||||||
attr_accessor :name, :sell_in, :quality
|
|
||||||
|
|
||||||
def initialize(name, sell_in, quality)
|
|
||||||
@name = name
|
|
||||||
@sell_in = sell_in
|
|
||||||
@quality = quality
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_s()
|
|
||||||
"#{@name}, #{@sell_in}, #{@quality}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
require File.join(File.dirname(__FILE__), 'gilded_rose')
|
|
||||||
|
|
||||||
describe GildedRose do
|
|
||||||
|
|
||||||
describe "#update_quality" do
|
|
||||||
it "does not change the name" do
|
|
||||||
items = [Item.new("foo", 0, 0)]
|
|
||||||
GildedRose.new(items).update_quality()
|
|
||||||
expect(items[0].name).to eq "fixme"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
require File.join(File.dirname(__FILE__), 'gilded_rose')
|
|
||||||
require 'test/unit'
|
|
||||||
|
|
||||||
class TestUntitled < Test::Unit::TestCase
|
|
||||||
|
|
||||||
def test_foo
|
|
||||||
items = [Item.new("foo", 0, 0)]
|
|
||||||
GildedRose.new(items).update_quality()
|
|
||||||
assert_equal items[0].name, "fixme"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/ruby -w
|
|
||||||
|
|
||||||
require File.join(File.dirname(__FILE__), 'gilded_rose')
|
|
||||||
|
|
||||||
puts "OMGHAI!"
|
|
||||||
items = [
|
|
||||||
Item.new(name="+5 Dexterity Vest", sell_in=10, quality=20),
|
|
||||||
Item.new(name="Aged Brie", sell_in=2, quality=0),
|
|
||||||
Item.new(name="Elixir of the Mongoose", sell_in=5, quality=7),
|
|
||||||
Item.new(name="Sulfuras, Hand of Ragnaros", sell_in=0, quality=80),
|
|
||||||
Item.new(name="Sulfuras, Hand of Ragnaros", sell_in=-1, quality=80),
|
|
||||||
Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=15, quality=20),
|
|
||||||
Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=10, quality=49),
|
|
||||||
Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=5, quality=49),
|
|
||||||
# This Conjured item does not work properly yet
|
|
||||||
Item.new(name="Conjured Mana Cake", sell_in=3, quality=6), # <-- :O
|
|
||||||
]
|
|
||||||
|
|
||||||
days = 2
|
|
||||||
if ARGV.size > 0
|
|
||||||
days = ARGV[0].to_i + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
gilded_rose = GildedRose.new items
|
|
||||||
(0...days).each do |day|
|
|
||||||
puts "-------- day #{day} --------"
|
|
||||||
puts "name, sellIn, quality"
|
|
||||||
items.each do |item|
|
|
||||||
puts item
|
|
||||||
end
|
|
||||||
puts ""
|
|
||||||
gilded_rose.update_quality
|
|
||||||
end
|
|
||||||
Loading…
Reference in New Issue
Block a user