Sha256: 437555594a5abb29db843aa1e8ed5f0de70c0ddc0aa29ec225b44a20d689b07f

Contents?: true

Size: 283 Bytes

Versions: 305

Compression:

Stored size: 283 Bytes

Contents

class Pantry

  def initialize
    @items = {}
  end

  def add(food_name, count)
    @items[food_name] ||= 0
    @items[food_name] += count.to_i
  end

  def remove(food_name, count)
    @items[food_name] -= count.to_i
  end

  def count(food_name)
    @items[food_name]
  end

end

Version data entries

305 entries across 301 versions & 27 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/cucumber-1.3.18/fixtures/tickets/features/lib/pantry.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/cucumber-1.3.18/fixtures/tickets/features/lib/pantry.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/cucumber-1.3.16/fixtures/tickets/features/lib/pantry.rb
cucumber-1.3.20 fixtures/tickets/features/lib/pantry.rb
cucumber-1.3.19 fixtures/tickets/features/lib/pantry.rb
cucumber-1.3.18 fixtures/tickets/features/lib/pantry.rb
cucumber-1.3.17 fixtures/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.100.1 examples/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.100.2 examples/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.100.3 examples/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.100.4 examples/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.100.5 examples/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.13.2 examples/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.13.3 examples/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.13 examples/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.14.1 examples/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.14.2 examples/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.15 examples/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.16.1 examples/tickets/features/lib/pantry.rb
aslakhellesoy-cucumber-0.1.16.2 examples/tickets/features/lib/pantry.rb