From 5923417fecc5da0d7135bb44ce5f010c8a870e40 Mon Sep 17 00:00:00 2001 From: Tammam Kbeili Date: Mon, 15 Jun 2015 13:09:17 -0700 Subject: [PATCH 1/8] add dog class --- dog.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 dog.rb diff --git a/dog.rb b/dog.rb new file mode 100644 index 0000000..0141015 --- /dev/null +++ b/dog.rb @@ -0,0 +1,30 @@ +class Dog + + def initialize(color, type) + @color, @type = color, type + @bones = [] + end + + def give(bone) + # ensuring that the dog has less than three bones in order to accept a new + # one + if @bones.length < 3 + # add the bone to the bones array + @bones << bone + else + puts "Too many bones!" + end + end + + def eat + if @bones.length == 0 + puts "There are no bones!" + else + # the pop method on the array will remove and return the last element + # in the array. In this case @bones.pop will give us back a "bone" object + # the "bone" object has a "size" attribute. + puts "I ate a #{@bones.pop.size} bone!" + end + end + +end From 05d6c19b40fe11f5c1b8443cb94697a0d6d908be Mon Sep 17 00:00:00 2001 From: Tammam Kbeili Date: Mon, 15 Jun 2015 13:11:23 -0700 Subject: [PATCH 2/8] change the number of bones for the dog to 5 --- dog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dog.rb b/dog.rb index 0141015..3e6a5e5 100644 --- a/dog.rb +++ b/dog.rb @@ -8,7 +8,7 @@ def initialize(color, type) def give(bone) # ensuring that the dog has less than three bones in order to accept a new # one - if @bones.length < 3 + if @bones.length < 5 # add the bone to the bones array @bones << bone else From 7525af33532c70ea53016323bb2e4d469b3c9b22 Mon Sep 17 00:00:00 2001 From: Tammam Kbeili Date: Mon, 15 Jun 2015 13:13:38 -0700 Subject: [PATCH 3/8] change the number of the dog bones to 6 --- dog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dog.rb b/dog.rb index 0141015..e4de679 100644 --- a/dog.rb +++ b/dog.rb @@ -8,7 +8,7 @@ def initialize(color, type) def give(bone) # ensuring that the dog has less than three bones in order to accept a new # one - if @bones.length < 3 + if @bones.length < 6 # add the bone to the bones array @bones << bone else From 1c0e73197d794da420537e7a3aebed32c098e73f Mon Sep 17 00:00:00 2001 From: Tammam Kbeili Date: Mon, 15 Jun 2015 13:26:42 -0700 Subject: [PATCH 4/8] change the number of bones to 10 --- dog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dog.rb b/dog.rb index 1bdd69b..a787685 100644 --- a/dog.rb +++ b/dog.rb @@ -8,7 +8,7 @@ def initialize(color, type) def give(bone) # ensuring that the dog has less than three bones in order to accept a new # one - if @bones.length < 7 + if @bones.length < 10 # add the bone to the bones array @bones << bone else From 50134f5349746d6b9493c960dd34be33e5ce7710 Mon Sep 17 00:00:00 2001 From: Tammam Kbeili Date: Mon, 15 Jun 2015 13:45:20 -0700 Subject: [PATCH 5/8] change bone count to 999 --- dog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dog.rb b/dog.rb index a787685..03ee51f 100644 --- a/dog.rb +++ b/dog.rb @@ -8,7 +8,7 @@ def initialize(color, type) def give(bone) # ensuring that the dog has less than three bones in order to accept a new # one - if @bones.length < 10 + if @bones.length < 999 # add the bone to the bones array @bones << bone else From c8fa49c8a746373c9917fcee6e2392afb32646b6 Mon Sep 17 00:00:00 2001 From: Tammam Kbeili Date: Mon, 15 Jun 2015 13:57:27 -0700 Subject: [PATCH 6/8] change the bone number to 888 --- dog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dog.rb b/dog.rb index 03ee51f..d1314b3 100644 --- a/dog.rb +++ b/dog.rb @@ -8,7 +8,7 @@ def initialize(color, type) def give(bone) # ensuring that the dog has less than three bones in order to accept a new # one - if @bones.length < 999 + if @bones.length < 888 # add the bone to the bones array @bones << bone else From a545a47be32eb0d8434ba04beb35fc9865ccf3c8 Mon Sep 17 00:00:00 2001 From: alwesam Date: Mon, 15 Jun 2015 13:43:59 -0700 Subject: [PATCH 7/8] changed number of bones to 172 --- dog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dog.rb b/dog.rb index d1314b3..ad3ab46 100644 --- a/dog.rb +++ b/dog.rb @@ -8,7 +8,7 @@ def initialize(color, type) def give(bone) # ensuring that the dog has less than three bones in order to accept a new # one - if @bones.length < 888 + if @bones.length < 172 # add the bone to the bones array @bones << bone else From 53cbb3adabf8879c002a3b511e32c1b28bb4f54f Mon Sep 17 00:00:00 2001 From: distienct Date: Mon, 15 Jun 2015 13:43:15 -0700 Subject: [PATCH 8/8] changed bone number to 421 --- dog.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dog.rb b/dog.rb index ad3ab46..7478ee8 100644 --- a/dog.rb +++ b/dog.rb @@ -8,7 +8,8 @@ def initialize(color, type) def give(bone) # ensuring that the dog has less than three bones in order to accept a new # one - if @bones.length < 172 + if @bones.length < 421 + # add the bone to the bones array @bones << bone else