From 5923417fecc5da0d7135bb44ce5f010c8a870e40 Mon Sep 17 00:00:00 2001 From: Tammam Kbeili Date: Mon, 15 Jun 2015 13:09:17 -0700 Subject: [PATCH 1/9] 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/9] 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/9] 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/9] 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 823f7c259c7dc1d34fb8049dbc5ce730f9891aac Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 15 Jun 2015 13:45:43 -0700 Subject: [PATCH 5/9] update_bones_count --- dog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dog.rb b/dog.rb index a787685..7013fdc 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 < 9 # add the bone to the bones array @bones << bone else From 6ad0167c0ec39c0ff8d15788118fd160abeb0aa1 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 15 Jun 2015 13:48:44 -0700 Subject: [PATCH 6/9] Update_bone_count to 9 --- dog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dog.rb b/dog.rb index 7013fdc..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 < 9 + if @bones.length < 10 # add the bone to the bones array @bones << bone else From 0b36b27868b07d5f23544dfc3152a88d45e9866d Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 15 Jun 2015 13:49:25 -0700 Subject: [PATCH 7/9] Update_bone_count to 100 --- dog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dog.rb b/dog.rb index a787685..1e38977 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 < 100 # add the bone to the bones array @bones << bone else From 4c5302fb2cb72b47174d9263955a35da846158d9 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 15 Jun 2015 13:53:33 -0700 Subject: [PATCH 8/9] update bone count to 11 --- dog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dog.rb b/dog.rb index 1e38977..ead05e1 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 < 100 + if @bones.length < 11 # add the bone to the bones array @bones << bone else From ea38055d1a7e9423e51cb99f444aa8f9d3165c5b Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 15 Jun 2015 14:35:02 -0700 Subject: [PATCH 9/9] Change bones count to 99 --- dog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dog.rb b/dog.rb index ead05e1..d22fcaa 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 < 11 + if @bones.length < 99 # add the bone to the bones array @bones << bone else