diff --git a/.gitignore b/.gitignore deleted file mode 100644 index bf3b80c..0000000 --- a/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.DS_Store -/*/.DS_Store -/*/*/.DS_Store -.ruby-version -.ruby-gemset diff --git a/LICENSE b/LICENSE deleted file mode 100644 index c1c2a8e..0000000 --- a/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "[]" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - Copyright 2012 Renée Hendricksen - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/README.md b/README.md deleted file mode 100644 index 40c23d7..0000000 --- a/README.md +++ /dev/null @@ -1,70 +0,0 @@ -RubyFall2014 -============ - -Course Materials for the Ruby Continuing Education Certificate Program Fall 2014 Quarter - -Syllabus -============ - -Week 1 -* Setup -* Git -* rSpec - -Week 2 -* Strings -* Variables -* Classes and Objects - -Week 3 -* Array and hash -* Numbers / range -* Modules / inheritance - -Week 4 -* Range -* Symbols -* Control -* Blocks - -Week 5 -* Regexp -* I/O -* Files / Dir -* Rake - -Week 6 -* Projects intro -* Gems -* CI - -Week 7 -* Mid-term due! -* Cucumber -* Testing frameworks - -Week 8 -* Metaprogramming -* Duck typing -* Monkey patching - -Week 9 -* Exceptions -* Refactoring -* Review - -Week 10 -* Final due! -* Project due! -* Interesting Stuff - - -Gem Project Requirements -* Make a Gem! -* Source on Github -* Gem Released on RubyGems.org -* Full Documentation and Tests -* OSS License of your choice -* Tested on Travis CI (Bonus: Code Climate!) -* Ready to demo the last day of class - diff --git a/midterm/instructions_and_questions.txt b/midterm/instructions_and_questions.txt deleted file mode 100644 index a038c9d..0000000 --- a/midterm/instructions_and_questions.txt +++ /dev/null @@ -1,39 +0,0 @@ -Instructions for Mid-Term submission and Git Review (10pts): - - Create a git repository for your answers - - Add and Commit as you work through the questions and programming problems - - Your git log should reflect your work, don't just commit after you have finished working - - Use .gitignore to ignore any files that are not relevant to the midterm - - E-mail me your ssh public key - - I will email you back with your repository name - - Add a remote to your git repository: git@reneedv.com:RubyFall2014/YOURREPOSITORYNAME.git - - Push your changes to the remote - - After 6pm Thursday November 13th you will not be able to push to your remote repository (or clone). - - Questions (20pts): - - What are the three uses of the curly brackets {} in Ruby? - - What is a regular expression and what is a common use for them? - - What is the difference between how a String, a symbol, a FixNum, and a Float are stored in Ruby? - - Are these two statements equivalent? Why or Why Not? - 1. x, y = "hello", "hello" - 2. x = y = "hello" -- What is the difference between a Range and an Array? -- Why would I use a Hash instead of an Array? -- What is your favorite thing about Ruby so far? -- What is your least favorite thing about Ruby so far? - - Programming Problems (10pts each): - - Write a passing rspec file called even_number_spec.rb that tests a class called EvenNumber. - - The EvenNumber class should: - - Only allow even numbers - - Get the next even number - - Compare even numbers - - Generate a range of even numbers -- Make the rspec tests in wish_list_spec.rb pass by writing a WishList class - - The WishList class should: - - Mixin Enumerable - - Define each so it returns wishes as strings with their index as part of the string - -Mid-Term Spec (50pts): -- Make the tests pass. - - diff --git a/midterm/mid_term_spec.rb b/midterm/mid_term_spec.rb deleted file mode 100644 index 87e5c74..0000000 --- a/midterm/mid_term_spec.rb +++ /dev/null @@ -1,75 +0,0 @@ -require_relative '../../spec_helper.rb' -require "#{File.dirname(__FILE__)}/turkey" - -describe Turkey do - - before do - @turkey = Turkey.new(10) - end - - it "should report the turkey weight" do - @turkey.weight.should equal 10 - end - - it "should be a kind of animal" do - @turkey.kind_of?(Animal).should be_true - end - - it "should gobble speak" do - @turkey.gobble_speak("Hello I Am a Turkey. Please Don't Eat Me.").should eq "Gobble Gobble Gobble gobble Gobble. Gobble Gobb'le Gobble Gobble." - end - -end - -require "#{File.dirname(__FILE__)}/thanksgiving_dinner" - -describe ThanksgivingDinner do - - before do - @t_dinner = ThanksgivingDinner.new(:vegan) - @t_dinner.guests = ["Aunt Petunia", "Uncle Vernon", "Aunt Marge", "Dudley", "Harry"] # I know I just made a British family celebrate Thanksgiving, but it could be worse: It could have been the 4th of July! :) - end - - it "should be a kind of dinner" do - @t_dinner.kind_of?(Dinner).should be_true - end - - # Use inject here - it "should sum the letters in each guest name for the seating chart size" do - @t_dinner.seating_chart_size.should eq 45 - end - - it "should provide a menu" do - @t_dinner.respond_to?(:menu).should be_true - end - - context "#menu" do - - it "should have a diet specified" do - @t_dinner.menu[:diet].should eq :vegan - end - - it "should have proteins" do - @t_dinner.menu[:proteins].should eq ["Tofurkey", "Hummus"] - end - - it "should have vegetables" do - @t_dinner.menu[:veggies].should eq [:ginger_carrots , :potatoes, :yams] - end - - # Dinners don't always have dessert, but ThanksgivingDinners always do! - it "should have desserts" do - @t_dinner.menu[:desserts].should eq({:pies => [:pumkin_pie], :other => ["Chocolate Moose"], :molds => [:cranberry, :mango, :cherry]}) - end - - end - - # Use String interpolation, collection methods, and string methods for these two examples - it "should return what is on the dinner menu" do - @t_dinner.whats_for_dinner.should eq "Tonight we have proteins Tofurkey and Hummus, and veggies Ginger Carrots, Potatoes, and Yams." - end - - it "should return what is on the dessert menu" do - @t_dinner.whats_for_dessert.should eq "Tonight we have 5 delicious desserts: Pumkin Pie, Chocolate Moose, and 3 molds: Cranberry and Mango and Cherry." - end -end diff --git a/midterm/wish_list_spec.rb b/midterm/wish_list_spec.rb deleted file mode 100644 index 87f2813..0000000 --- a/midterm/wish_list_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require "#{File.dirname(__FILE__)}/wish_list" - -describe WishList do - before :each do - @wish_list = WishList.new - @wish_list.wishes = ["Lamborghini", "Corn Starch and Water Moat", "Vegan Bacon Ice Cream", "Rubber Chicken", "Free Tickets to MockingJay"] - end - - it "should mixin Enumerable" do - @wish_list.is_a?(Enumerable).should be_true - end - - context "#each" do - it "should give me a numberd list" do - @wish_list.map{|w| w}.should eq ["1. Lamborghini", "2. Corn Starch and Water Moat", "3. Vegan Bacon Ice Cream", "4. Rubber Chicken", "5. Free Tickets to MockingJay"] - end - end -end \ No newline at end of file diff --git a/resources.md b/resources.md deleted file mode 100644 index 61730bc..0000000 --- a/resources.md +++ /dev/null @@ -1,62 +0,0 @@ -####General -[Our Github repo](https://github.com/UWE-Ruby/RubyWinter2014) - -[Our chat room](https://uweruby.hipchat.com) - -####Week 1: Setup, Git, rSpec -Class slides (coming soon!) - -[Free Online Text-Book](http://www.ruby-doc.org/docs/ProgrammingRuby/) (older edition, but should be fine for this week's reading.) - -[Rspec Matchers](http://rubydoc.info/gems/rspec-expectations/2.4.0/RSpec/Matchers) - -[Svn to Git Crash Course](http://git.or.cz/course/svn.html) - if you are switching to Git from Subversion - -[Git Immersion](http://gitimmersion.com/)- general Git course - -[ANSICON Instructions from Price](http://qastuffs.blogspot.com/2011/02/how-to-install-ansicon-for-cucumber-to.html) - -[Command line basics](http://linuxbloggen.dk/wp-content/gallery/cheat-sheets/clicommandsfull.jpg) - -####Week 2: Strings, Variables, Classes, and Objects -[Ruby Docs](http://www.ruby-doc.org/core-1.9.3/String.html) - -[Pragmatic Programmers Guide](http://pragprog.com/book/ruby3/programming-ruby-1-9) (at the bottom is the link to the extending Ruby pdf I mentioned) - -[Travis CI](https://travis-ci.org) (where open source projects are tested) - -[grb](https://github.com/jinzhu/grb) - -[The Ruby ToolBox](https://www.ruby-toolbox.com/) - -####Week 3: Array and hash, Numbers / range, Modules / inheritance -[Enumerable](http://ruby-doc.org/core-1.9.3/Enumerable.html) - -[BigDecimal](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/bigdecimal/rdoc/BigDecimal.html) - -[Array](http://www.ruby-doc.org/core-1.9.3/Array.html) - -[Hash](http://www.ruby-doc.org/core-1.9.3/Hash.html) - -[Range](http://ruby-doc.org/core-1.9.3/Range.html) - -[Why's Poignant Guide](http://mislav.uniqpath.com/poignant-guide/) - -####Week 4: Range, Symbols, Blocks, Control -[Blocks, Procs, Lambdas, and Closures](http://www.robertsosinski.com/2008/12/21/understanding-ruby-blocks-procs-and-lambdas/) - -####Week 5: Regexp, I/O, Files/Dir, Rake -[Rubular](http://www.rubular.com/) -[ASCII Table](http://www.asciitable.com/) - -[Breaking up Regular expressions](http://stackoverflow.com/questions/3833787/making-a-small-regular-expression-a-bit-more-readable) - -####Week 6: Gems, CI - -####Week 7: Cucumber, Testing frameworks, Refactoring - -####Week 8: Metaprogramming, Duck typing, Monkey patching - -####Week 9: Review, Exceptions - -####Week 10: Interesting Stuff... diff --git a/spec_helper.rb b/spec_helper.rb deleted file mode 100644 index 0f63c0c..0000000 --- a/spec_helper.rb +++ /dev/null @@ -1,8 +0,0 @@ -RSpec.configure do |config| - config.expect_with :rspec do |c| - c.syntax = [:should, :expect] - end - config.mock_with :rspec do |mocks| - mocks.syntax = :should - end -end \ No newline at end of file diff --git a/week1/class_materials/resources.txt b/week1/class_materials/resources.txt deleted file mode 100644 index 6ecf69c..0000000 --- a/week1/class_materials/resources.txt +++ /dev/null @@ -1,27 +0,0 @@ -Links from Class: - -Our Github: https://github.com/UWE-Ruby/RubyFall2014 - -Free Online Text-Book: http://www.ruby-doc.org/docs/ProgrammingRuby/ (older edition, but should be fine for this week's reading.) - -Rspec Matchers: http://rubydoc.info/gems/rspec-expectations/2.4.0/RSpec/Matchers - -Git-Svn Crash Course: http://git.or.cz/course/svn.html -Git Immersion: http://gitimmersion.com/ -Cheri's Git Slides: http://dinosaurparty.info/gitslides.html - -Windows Color Terminal Solutions: - -ANSICON Instructions: http://qastuffs.blogspot.com/2011/02/how-to-install-ansicon-for-cucumber-to.html - -I do want to share info about a console editor: My laptop runs Windows7 x64 and I was never able to get ansicon to work properly -- the control characters that should change the color of text (i.e. red & green for testing) would never really work. I researched & found that I was far from alone. - -I came across ConEmu (for "console emulator") and it's great. You can open up multiple tabbed console windows, and you can set up commands (called "tasks" in ConEmu") to customize and start different console windows/tabs. The control characters are interpreted correctly (they change the text color as they should) https://code.google.com/p/conemu-maximus5/ - -In case someone else wants to use it, here is the setup for it to run the RailsInstaller/git environment: - -Task parameter: /Dir "C:\RailsInstaller\Ruby1.9.3" - -command: cmd /k C:\RailsInstaller\Ruby1.9.3\setup_environment.bat C:\RailsInstaller -new_console - -(That will make sense in ConEmu.) That will create a new console window/tab, will run setup_environment.bat, and will change to the RailsInstaller\Ruby1.9.3 directory. diff --git a/week1/class_materials/week1.key b/week1/class_materials/week1.key deleted file mode 100644 index 283ccc3..0000000 Binary files a/week1/class_materials/week1.key and /dev/null differ diff --git a/week1/class_materials/week1.pdf b/week1/class_materials/week1.pdf deleted file mode 100644 index acc49ab..0000000 Binary files a/week1/class_materials/week1.pdf and /dev/null differ diff --git a/week1/examples/ruby_spec.rb b/week1/examples/ruby_spec.rb deleted file mode 100644 index 5922be1..0000000 --- a/week1/examples/ruby_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'rspec/collection_matchers' -require_relative '../../spec_helper' - -describe "Playing With Ruby! " do - context 'when adding numbers' do - it "should add numbers" do - (2+2).should eq 4 - end - end -end \ No newline at end of file diff --git a/week1/exercises/.rspec b/week1/exercises/.rspec deleted file mode 100644 index 16f9cdb..0000000 --- a/week1/exercises/.rspec +++ /dev/null @@ -1,2 +0,0 @@ ---color ---format documentation diff --git a/week1/exercises/roster.txt b/week1/exercises/roster.txt deleted file mode 100644 index 9305f7f..0000000 --- a/week1/exercises/roster.txt +++ /dev/null @@ -1,17 +0,0 @@ -#, name, email, github, twitter, hip chat -0, Renée, renee@nird.us, reneedv, @nirdllc, Renee -1, Katie, katrops@gmail.com, katrops, @kjtrops, Katie -2, -3, Alex, lumberjackparade@hotmail.com, Pensive1881 -4, Rick, rcrelia@gmail.com, rcrelia, @rcrelia, Rick -5, Edwin, edwin.fu@gmail.com, edwinfu, @edwinfu, -6, Gregg, gpg@gregory-gadow.net, GGadow, n/a, Gregg -7 Alicia, aliciagoodwin@gmail.com, sojama -8, Scott Kostojohn, skostojohn@hotmail.com,skostojohn,@crm_scott, Scott -9, Kenny, lukenny@gmail.com, lukenny, , Kenny -10, Nathan, nathanrohm@gmail.com, natron19, natron19, natron19 -11, Emily, emxruf@gmail.com, no twitter, metroretro, Emily -12, joseph , jjs0sbw@gmail.com, jjs0sbw, @jjs0sbw, huh? -13, -14, Tom, tunderhill@gmail.com, tomun, @tomun, -15, Surendra, mohan.surendra@gmail.com, syearva, , diff --git a/week1/exercises/rspec_spec.rb b/week1/exercises/rspec_spec.rb deleted file mode 100644 index c4c5e0b..0000000 --- a/week1/exercises/rspec_spec.rb +++ /dev/null @@ -1,96 +0,0 @@ -# encoding: utf-8 -require 'rspec/collection_matchers' -require_relative '../../spec_helper' -describe "The Rspec ruby gem" do - - context "Domain Specific Language" do - - it "creates examples with the #it keyword" do - - # this test code passes, so this example passes - 1.should eq 1 - - end - - it "has keywords like #context, and #describe to help organize the spec, or specification" do - - # test code goes here - (1+2).should eq 3 - - end - - it "has easily readable methods like #should to test any object" do - - "Hello".should eq "Hello" - - end - - it "has #should_not to test for negative cases" do - - 1.should_not eq 2 - - end - - it "creates readable predicate methods" do - - # Integers have #zero? and #nil? predicate methods, so - # rspec automatically supports the #be_zero and #be_nil parameter to #should_not method - 1.should_not be_zero - 1.should_not be_nil - - end - - it "alerts you when examples fail" do - - # When this example fails, - # it will show "expected" as 2, and "actual" as 1 - 1.should eq 2 - - end - - it "supports placeholder examples that lack code (like this one)" - - it "requires that examples use expectations (like #should) to work properly" do - - # The following expression is false. - # However, this example PASSES because no expectation was created. - true == false - - # The following line of code is correct, and would cause the example to fail: - # true.should == false - - # Lesson: It's easy to write bad tests. - - end - - it "should count the characters in my name" do - "Renée".should have(5).characters - end - - it "should check how to spell my name" do - "Renée".should include("ée") - end - - end - - context "Examples for in-class test exploration" do - it "should know order of operations" do - # Fix the Failing Test - # Order of Operations is Please Excuse My Dear Aunt Sally: - # Parentheses, Exponents, Multiplication, Division, Addition, Subtraction - (1+2-5*6/2).should eq -12 - end - it "should count the characters in your name" do - "Tom".should have(3).characters - end - - it "should check basic math" do - (1+1).should eq 2 - end - - it "should check basic spelling" do - "field".should include("ie") - end - - end -end \ No newline at end of file diff --git a/week1/homework/questions.txt b/week1/homework/questions.txt deleted file mode 100644 index 2257bb9..0000000 --- a/week1/homework/questions.txt +++ /dev/null @@ -1,15 +0,0 @@ -Please read: -Chapter 3 Classes, Objects, and Variables -p.86-90 Strings (Strings section in Chapter 6 Standard Types) - -1. What is an object? - -2. What is a variable? - -3. What is the difference between an object and a class? - -4. What is a String? - -5. What are three messages that I can send to a string object? Hint: think methods - -6. What are two ways of defining a String literal? Bonus: What is the difference between them? diff --git a/week1/homework/strings_and_rspec_spec.rb b/week1/homework/strings_and_rspec_spec.rb deleted file mode 100644 index 496e61d..0000000 --- a/week1/homework/strings_and_rspec_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -require 'rspec/collection_matchers' -require_relative '../../spec_helper' - -# encoding: utf-8 - -# Please make these examples all pass -# You will need to change the 3 pending tests -# You will need to write a passing test for the first example -# (Hint: If you need help refer to the in-class exercises) -# The two tests with the pending keyword, require some ruby code to be written -# (Hint: You should do the reading on Strings first) - -describe String do - context "When a string is defined" do - before(:all) do - @my_string = "Renée is a fun teacher. Ruby is a really cool programming language" - end - - it "should be able to count the charaters" - - it "should be able to split on the . charater" do - pending - result = #do something with @my_string here - result.should have(2).items - end - - it "should be able to give the encoding of the string" do - pending 'helpful hint: should eq (Encoding.find("UTF-8"))' - encodeing #do something with @my_string here - #use helpful hint here - end - end -end - diff --git a/week2/class_materials/resources.txt b/week2/class_materials/resources.txt deleted file mode 100644 index 965c8b3..0000000 --- a/week2/class_materials/resources.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Ruby Docs: http://www.ruby-doc.org/core-1.9.3/String.html -Pragmatic Programmers Guide: http://pragprog.com/book/ruby3/programming-ruby-1-9 (at the bottom is the link to the extending Ruby pdf I mentioned) - -Travis CI (where open source projects are tested): https://travis-ci.org -grb: https://github.com/jinzhu/grb -The Ruby ToolBox: https://www.ruby-toolbox.com/ - -my alias for rspec: -alias rspec="rspec --color --format documentation" diff --git a/week2/class_materials/week2.key b/week2/class_materials/week2.key deleted file mode 100644 index fb010aa..0000000 Binary files a/week2/class_materials/week2.key and /dev/null differ diff --git a/week2/class_materials/week2.pdf b/week2/class_materials/week2.pdf deleted file mode 100644 index 93497a0..0000000 Binary files a/week2/class_materials/week2.pdf and /dev/null differ diff --git a/week2/exercises/book.rb b/week2/exercises/book.rb deleted file mode 100644 index 34931fa..0000000 --- a/week2/exercises/book.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Book - attr_accessor :title - attr_reader :page_count - - @@book_count = 0 - - def self.book_count - @@book_count - end - - def initialize title = "Not Set", page_count = 0 - @@book_count += 1 - @page_count = page_count - @title = title - end - -end \ No newline at end of file diff --git a/week2/exercises/book_spec.rb b/week2/exercises/book_spec.rb deleted file mode 100644 index 4662c1a..0000000 --- a/week2/exercises/book_spec.rb +++ /dev/null @@ -1,49 +0,0 @@ -require_relative 'book' -require_relative '../../spec_helper' - -describe Book do - - context "::book_count" do - - it "should count how many books have been created" do - Book.new - Book.new - Book.new - Book.book_count.should eq 3 - end - - end - - context "::new" do - - it "should set some defaults" do - Book.new.title.should eq "Not Set" - end - - it "should allow us to set the page count" do - book = Book.new "Harry Potter", 5 - book.page_count.should eq 5 - end - - end - - context "#title" do - - before :each do - @book = Book.new - end - - it "should have a title" do - @book.should respond_to "title" - end - - it "should allow me to set the title" do - @book.title = "Snow Crash" - @book.title.should eq "Snow Crash" - end - - - - end - -end \ No newline at end of file diff --git a/week2/exercises/mad_libs.rb b/week2/exercises/mad_libs.rb deleted file mode 100644 index 3af5583..0000000 --- a/week2/exercises/mad_libs.rb +++ /dev/null @@ -1,10 +0,0 @@ -puts "Please enter a noun" -noun = gets.chomp -puts "Please enter an adjective" -adjective = gets.chomp -puts "Please enter a past tense action verb" -verb_past_tense = gets.chomp -puts "What does the #{noun} say?" -says = gets.chomp -story = "The #{adjective} #{noun} #{verb_past_tense} past the graveyard and says #{says}" -puts story diff --git a/week2/homework/questions.txt b/week2/homework/questions.txt deleted file mode 100644 index 939e42d..0000000 --- a/week2/homework/questions.txt +++ /dev/null @@ -1,13 +0,0 @@ -Please Read The Chapters on: -Containers, Blocks, and Iterators -Sharing Functionality: Inheritance, Modules, and Mixins - -1. What is the difference between a Hash and an Array? - -2. When would you use an Array over a Hash and vice versa? - -3. What is a module? Enumerable is a built in Ruby module, what is it? - -4. Can you inherit more than one thing in Ruby? How could you get around this problem? - -5. What is the difference between a Module and a Class? diff --git a/week2/homework/simon_says_spec.rb b/week2/homework/simon_says_spec.rb deleted file mode 100644 index 4e6f5bc..0000000 --- a/week2/homework/simon_says_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -# Hint: require needs to be able to find this file to load it -require_relative "simon_says.rb" -require_relative '../../spec_helper' - -describe SimonSays do - include SimonSays # Hint: Inclusion is different than SimonSays.new (read about modules) - - # Hint: We are just calling methods, we are not passing a message to a SimonSays object. - it "should echo hello" do - echo("hello").should == "hello" - end - - it "should echo bye" do - echo("bye").should == "bye" - end - - it "should shout hello" do - shout("hello").should == "HELLO" - end - - it "should shout multiple words" do - shout("hello world").should == "HELLO WORLD" - end - - it "should repeat" do - repeat("hello").should == "hello hello" - end - - it "should repeat a number of times" do - repeat("hello", 3).should == "hello hello hello" - end - - it "should return the first letter" do - start_of_word("hello", 1).should == "h" - end - - it "should return the first two letters" do - start_of_word("Bob", 2).should == "Bo" - end - - it "should tell us the first word of 'Hello World' is 'Hello'" do - first_word("Hello World").should == "Hello" - end - - it "should tell us the first word of 'oh dear' is 'oh'" do - first_word("oh dear").should == "oh" - end -end diff --git a/week3/class_materials/resources.txt b/week3/class_materials/resources.txt deleted file mode 100644 index 9a1fa74..0000000 --- a/week3/class_materials/resources.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Enumerable: http://ruby-doc.org/core-1.9.3/Enumerable.html -BigDecimal: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/bigdecimal/rdoc/BigDecimal.html -Array: http://www.ruby-doc.org/core-1.9.3/Array.html -Hash: http://www.ruby-doc.org/core-1.9.3/Hash.html -Range: http://ruby-doc.org/core-1.9.3/Range.html - -Why's Poignant Guide: http://mislav.uniqpath.com/poignant-guide/ diff --git a/week3/class_materials/week3.key b/week3/class_materials/week3.key deleted file mode 100644 index 1cf17bb..0000000 Binary files a/week3/class_materials/week3.key and /dev/null differ diff --git a/week3/class_materials/week3.pdf b/week3/class_materials/week3.pdf deleted file mode 100644 index a285ac8..0000000 Binary files a/week3/class_materials/week3.pdf and /dev/null differ diff --git a/week3/exercises/book.rb b/week3/exercises/book.rb deleted file mode 100644 index c13e4d4..0000000 --- a/week3/exercises/book.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Book - - def pages - - end - -end \ No newline at end of file diff --git a/week3/exercises/book_spec.rb b/week3/exercises/book_spec.rb deleted file mode 100644 index 72bc203..0000000 --- a/week3/exercises/book_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require './book.rb' - -describe Book do - - it "should have a pages" do - book = Book.new - book.should respond_to "pages" - end - -end \ No newline at end of file diff --git a/week3/exercises/monster.rb b/week3/exercises/monster.rb deleted file mode 100644 index 013c3d2..0000000 --- a/week3/exercises/monster.rb +++ /dev/null @@ -1,14 +0,0 @@ -require './named_thing.rb' -class Monster - include NamedThing - attr_accessor :vulnerabilities, :dangers - attr_reader :nocturnal, :legs - - def initialize(noc, legs, name="Monster", vul = [], dangers = []) - super(name) - @nocturnal = noc - @vlunerabilities = vul - @dangers = dangers - @legs = legs - end -end diff --git a/week3/exercises/monsters.rb b/week3/exercises/monsters.rb deleted file mode 100644 index 0635daa..0000000 --- a/week3/exercises/monsters.rb +++ /dev/null @@ -1,37 +0,0 @@ -$monsters = [] - -$monsters << { - :name => 'Zombie', - :nocturnal => false, - :dangers => ['bites', 'scratches'], - :vulnerabilities => ['fire', 'decapitation'], - :legs => 2 -} -$monsters << { - :name => 'Mummy', - :nocturnal => false, - :dangers => ['bites', 'scratches', 'curses'], - :vulnerabilities => ['fire', 'decapitation', 'cats'], - :legs => 2 -} -$monsters << { - :name => 'Vampire', - :nocturnal => true, - :dangers => ['bites', 'hypnosis'], - :vulnerabilities => ['wood', 'decapitation', 'crosses', 'holy_water', 'garlic', 'daylight'], - :legs => 2 -} -$monsters << { - :name => 'Werewolf', - :nocturnal => true, - :dangers => ['bites', 'scratches'], - :vulnerabilities => ['silver'], - :legs => 4 -} -$monsters << { - :name => 'Blob', - :nocturnal => false, - :dangers => ['suffocation'], - :vulnerabilities => ['CO2', 'ice', 'cold'], - :legs => 0 -} diff --git a/week3/exercises/named_thing.rb b/week3/exercises/named_thing.rb deleted file mode 100644 index 0f36422..0000000 --- a/week3/exercises/named_thing.rb +++ /dev/null @@ -1,15 +0,0 @@ -module NamedThing - attr_accessor :name - - def initialize name - @name = name - end - - def say_name - "My name is #{@name}" - end - - def shout_name - @name.upcase - end -end diff --git a/week3/exercises/vampire.rb b/week3/exercises/vampire.rb deleted file mode 100644 index 764adf6..0000000 --- a/week3/exercises/vampire.rb +++ /dev/null @@ -1,6 +0,0 @@ -require './monster.rb' -class Vampire < Monster - def initialize(noc=true, legs=2, name ="Vampire", vul=[:garlic, :sunlight], dangers=[:bites]) - super(noc,legs,name,vul,dangers) - end -end diff --git a/week3/homework/calculator_spec.rb b/week3/homework/calculator_spec.rb deleted file mode 100644 index 6ae227b..0000000 --- a/week3/homework/calculator_spec.rb +++ /dev/null @@ -1,70 +0,0 @@ -# another way of doing require_relative -require "#{File.dirname(__FILE__)}/calculator" -require_relative '../../spec_helper' - -describe Calculator do - - before do - @calculator = Calculator.new - end - - describe "#sum" do - it "computes the sum of an empty array" do - @calculator.sum([]).should == 0 - end - - it "computes the sum of an array of one number" do - @calculator.sum([7]).should == 7 - end - - it "computes the sum of an array of two numbers" do - @calculator.sum([7,11]).should == 18 - end - - it "computes the sum of an array of many numbers" do - @calculator.sum([1,3,5,7,9]).should == 25 - end - end - - # Once the above tests pass, - # write tests and code for the following: - describe "#multiply" do - it "multiplies two numbers" do - @calculator.multiply(2,2).should eq 4 - end - - it "multiplies an array of numbers" do - @calculator.multiply([2,2]).should eq 4 - end - end - - it "raises one number to the power of another number" do - p = 1 - 32.times{ p *= 2 } - @calculator.pow(2,32).should eq p - end - - # http://en.wikipedia.org/wiki/Factorial - describe "#factorial" do - it "computes the factorial of 0" do - @calculator.fac(0).should eq 1 - end - it "computes the factorial of 1" do - @calculator.fac(1).should eq 1 - end - - it "computes the factorial of 2" do - @calculator.fac(2).should eq 2 - end - - it "computes the factorial of 5" do - @calculator.fac(5).should eq 120 - end - - it "computes the factorial of 10" do - @calculator.fac(10).should eq 3628800 - end - - end - -end diff --git a/week3/homework/questions.txt b/week3/homework/questions.txt deleted file mode 100644 index dfb158d..0000000 --- a/week3/homework/questions.txt +++ /dev/null @@ -1,15 +0,0 @@ -Please Read: - - Chapter 6 Standard Types - - Review Blocks - - Chapter 7 Regular Expressions - - Chapter 22 The Ruby Language: basic types (symbols), variables and constants - -1. What is a symbol? - -2. What is the difference between a symbol and a string? - -3. What is a block and how do I call a block? - -4. How do I pass a block to a method? What is the method signature? - -5. Where would you use regular expressions? diff --git a/week4/class_materials/odd_number.rb b/week4/class_materials/odd_number.rb deleted file mode 100644 index 1c86876..0000000 --- a/week4/class_materials/odd_number.rb +++ /dev/null @@ -1,18 +0,0 @@ -class OddNumber - include Comparable - attr_accessor :value - - def initialize value - @value = value - end - - def succ - return OddNumber.new(@value + 1) if @value.even? - OddNumber.new(@value + 2) - end - - def <=> other - @value <=> other.value - end -end - diff --git a/week4/class_materials/resources.txt b/week4/class_materials/resources.txt deleted file mode 100644 index 725756d..0000000 --- a/week4/class_materials/resources.txt +++ /dev/null @@ -1,3 +0,0 @@ -Blocks, Procs, Lambdas, and Closures: http://www.robertsosinski.com/2008/12/21/understanding-ruby-blocks-procs-and-lambdas/ - - diff --git a/week4/class_materials/timer.rb b/week4/class_materials/timer.rb deleted file mode 100644 index 67b7681..0000000 --- a/week4/class_materials/timer.rb +++ /dev/null @@ -1,8 +0,0 @@ -class Timer - def self.time_code(n=1) - start_time = Time.now - n.times{yield} - end_time = Time.now - (end_time - start_time) / n.to_f - end -end \ No newline at end of file diff --git a/week4/class_materials/timer_spec.rb b/week4/class_materials/timer_spec.rb deleted file mode 100644 index e7c83b7..0000000 --- a/week4/class_materials/timer_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -require_relative '../../spec_helper.rb' -require "#{File.dirname(__FILE__)}/timer" - -describe Timer do - - it "should report the time difference" do - Time.stub(:now).and_return(0,3) - time_difference = Timer.time_code do - end - time_difference.should be_within(0.1).of(3.0) - end - - it "should run our code" do - flag = false - Timer.time_code do - flag = true - end - flag.should be_true - end - - it "should run our code multiple times" do - counter = 0 - result = Timer.time_code(17) {counter += 1} - counter.should equal 17 - end - - it "should give the average time" do - Time.stub(:now).and_return(0,10) - result = Timer.time_code(10) { } - result.should be_within(0.1).of(1) - end - -end diff --git a/week4/class_materials/week4.key b/week4/class_materials/week4.key deleted file mode 100644 index ac3687b..0000000 Binary files a/week4/class_materials/week4.key and /dev/null differ diff --git a/week4/class_materials/week4.pdf b/week4/class_materials/week4.pdf deleted file mode 100644 index 30c75fa..0000000 Binary files a/week4/class_materials/week4.pdf and /dev/null differ diff --git a/week4/exercises/monsters.rb b/week4/exercises/monsters.rb deleted file mode 100644 index e86bbf6..0000000 --- a/week4/exercises/monsters.rb +++ /dev/null @@ -1,53 +0,0 @@ -$monsters = [] - -$monsters << { - :name => 'Zombie', - :nocturnal => false, - :dangers => ['bites', 'scratches'], - :vulnerabilities => ['fire', 'decapitation'], - :legs => 2 -} -$monsters << { - :name => 'Mummy', - :nocturnal => false, - :dangers => ['bites', 'scratches', 'curses'], - :vulnerabilities => ['fire', 'decapitation', 'cats'], - :legs => 2 -} -$monsters << { - :name => 'Vampire', - :nocturnal => true, - :dangers => ['bites', 'hypnosis'], - :vulnerabilities => ['wood', 'decapitation', 'crosses', 'holy_water', 'garlic', 'daylight'], - :legs => 2 -} -$monsters << { - :name => 'Werewolf', - :nocturnal => true, - :dangers => ['bites', 'scratches'], - :vulnerabilities => ['silver'], - :legs => 4 -} -$monsters << { - :name => 'Blob', - :nocturnal => false, - :dangers => ['suffocation'], - :vulnerabilities => ['CO2', 'ice', 'cold'], - :legs => 0 -} - -puts "How many monsters are nocturnal?" -puts $monsters.count{|m| m[:nocturnal]} - -puts "What are the names of the monsters that are nocturnal?" -puts $monsters.select{|m| m[:nocturnal]}.map{|m| m[:name]} - -puts "How many legs do all our monsters have?" -puts $monsters.map{|m| m[:legs]}.inject(:+) - -puts "What are the 2 most common dangers and vulnerabilities of our monsters?" -puts "2 most common dangers:" -puts $monsters.map{|m| m[:dangers]}.flatten.inject(Hash.new(0)){|h,d| h[d] += 1; h}.sort_by{|k,v| v}[-2..-1].map{|a| a[0]} -puts "2 most common vulnerabilities:" -puts $monsters.map{|m| m[:vulnerabilities]}.flatten.inject(Hash.new(0)){|h,v| h[v] += 1; h}.sort_by{|k,v| v}[-2..-1].map{|a| a[0]} - diff --git a/week4/homework/questions.txt b/week4/homework/questions.txt deleted file mode 100644 index ffaf215..0000000 --- a/week4/homework/questions.txt +++ /dev/null @@ -1,13 +0,0 @@ -Please Read: -Chapter 10 Basic Input and Output -The Rake Gem: http://rake.rubyforge.org/ - -1. How does Ruby read files? - -2. How would you output "Hello World!" to a file called my_output.txt? - -3. What is the Directory class and what is it used for? - -4. What is an IO object? - -5. What is rake and what is it used for? What is a rake task? diff --git a/week4/homework/worker_spec.rb b/week4/homework/worker_spec.rb deleted file mode 100644 index 993cd49..0000000 --- a/week4/homework/worker_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -require_relative '../../spec_helper.rb' -require "#{File.dirname(__FILE__)}/worker" - -describe Worker do - - it "executes a block and returns a string" do - result = Worker.work do - "hello" - end - result.should == "hello" - end - - it "executes a block and returns a number" do - result = Worker.work do - 3 + 4 - end - result.should == 7 - end - - it "executes a block in the context of the calling method" do - n = 1 - result = Worker.work do - n + 4 - end - result.should == 5 - end - - - it "executes a block 3 times and returns the result" do - n = 5 - result = Worker.work(3) do - n += 1 - end - result.should == 8 - end - -end diff --git a/week5/class_materials/week5.key b/week5/class_materials/week5.key deleted file mode 100644 index fd73408..0000000 Binary files a/week5/class_materials/week5.key and /dev/null differ diff --git a/week5/class_materials/week5.pdf b/week5/class_materials/week5.pdf deleted file mode 100644 index a13a24a..0000000 Binary files a/week5/class_materials/week5.pdf and /dev/null differ diff --git a/week5/exercises/names b/week5/exercises/names deleted file mode 100644 index cb94f6f..0000000 --- a/week5/exercises/names +++ /dev/null @@ -1,35 +0,0 @@ -Ben -BrianT -BrianWard -BryanWilliams -Cheri -ChrisB -ChristopherF -ChristopherT -Danny -Dimitry -Eddie -Emily -Gregory -Josh -Karen -Kat -Kelli -Kris -Mallory -Nell -NicholasP -Nicole -Nikky -Peter -Price -Renée -Ryan -Santy -Serene -Sol -Steven -Strand -Timothy -Will -Yan diff --git a/week5/homework/do_your_mid_term b/week5/homework/do_your_mid_term deleted file mode 100644 index 18c8d0e..0000000 --- a/week5/homework/do_your_mid_term +++ /dev/null @@ -1,2 +0,0 @@ -Work on your Mid-Term!! -Really Do your mid term! diff --git a/week6/class_materials/week6.key b/week6/class_materials/week6.key deleted file mode 100644 index 49f2fac..0000000 Binary files a/week6/class_materials/week6.key and /dev/null differ diff --git a/week6/class_materials/week6.pdf b/week6/class_materials/week6.pdf deleted file mode 100644 index 930dfcc..0000000 Binary files a/week6/class_materials/week6.pdf and /dev/null differ diff --git a/week6/exercises/test_gem_instructions.txt b/week6/exercises/test_gem_instructions.txt deleted file mode 100644 index ad84c46..0000000 --- a/week6/exercises/test_gem_instructions.txt +++ /dev/null @@ -1 +0,0 @@ -http://guides.rubygems.org/make-your-own-gem diff --git a/week6/homework/homework.txt b/week6/homework/homework.txt deleted file mode 100644 index 38d093a..0000000 --- a/week6/homework/homework.txt +++ /dev/null @@ -1,2 +0,0 @@ -Release a test gem to RubyGems.org and email me your gem name -E-mail me your project idea diff --git a/week7/class_materials/cucumber/features/converter.feature b/week7/class_materials/cucumber/features/converter.feature deleted file mode 100644 index 9b7416d..0000000 --- a/week7/class_materials/cucumber/features/converter.feature +++ /dev/null @@ -1,17 +0,0 @@ -Feature: Converting metric - In order to pack for London - As a traveler - I want to be told the Celsius temperature in Fahrenheit - -Scenario: - Given I have entered 0 into the converter - And I select Celsius - When I press convert - Then the result should be 32.0 on the screen - -Scenario: - Given I have entered 21 into the converter - And I select Celsius - When I press convert - Then the result should be 69.8 on the screen - diff --git a/week7/class_materials/cucumber/features/step_definitions/converter.rb b/week7/class_materials/cucumber/features/step_definitions/converter.rb deleted file mode 100644 index e37c629..0000000 --- a/week7/class_materials/cucumber/features/step_definitions/converter.rb +++ /dev/null @@ -1,18 +0,0 @@ -class Converter - - def initialize(unit) - @unit = unit.to_f - end - - def type=(type) - @type = type - end - - def convert - self.send("#{@type}_convertion") - end - - def Celsius_convertion - (@unit * (9.0/5.0) + 32.0).round(1) - end -end diff --git a/week7/class_materials/cucumber/features/step_definitions/converter_steps.rb b/week7/class_materials/cucumber/features/step_definitions/converter_steps.rb deleted file mode 100644 index 61b9aae..0000000 --- a/week7/class_materials/cucumber/features/step_definitions/converter_steps.rb +++ /dev/null @@ -1,15 +0,0 @@ -Given /^I have entered (\d+) into the converter$/ do |arg1| - @converter = Converter.new(arg1) -end - -Given /^I select Celsius$/ do - @converter.type = "Celsius" -end - -When /^I press convert$/ do - @result = @converter.convert -end - -Then /^the result should be (\d+)\.(\d+) on the screen$/ do |arg1, arg2| - @result.should eq "#{arg1}.#{arg2}".to_f -end diff --git a/week7/class_materials/minitest/book.rb b/week7/class_materials/minitest/book.rb deleted file mode 100644 index 294444b..0000000 --- a/week7/class_materials/minitest/book.rb +++ /dev/null @@ -1,31 +0,0 @@ -class Book -end - -require 'minitest/autorun' - -# Unit tests - -class TestBook < MiniTest::Unit::TestCase - def setup - @book = Book.new('test', "Mr. Test", 4) - end - - def test_that_book_can_print_pretty - assert_equal "#{@book.title} - #{@book.author} pages: #{@book.page_count}", @book.pretty_print - end -end - -# Specs - -describe Book do - before do - @book = Book.new - @book.pages = ['This is page 1', 'Page 2 is this one', 'Page 3 is short', 'Page 4 is very very very long'] - end - - describe "when counting characters" do - it "should count the characters on every page" do - @book.characters.must_equal 29 - end - end -end \ No newline at end of file diff --git a/week7/class_materials/minitest/book_answers.rb b/week7/class_materials/minitest/book_answers.rb deleted file mode 100644 index 7a1f45d..0000000 --- a/week7/class_materials/minitest/book_answers.rb +++ /dev/null @@ -1,19 +0,0 @@ -class Book - - attr_accessor :title, :author, :page_count, :pages - - def initialize(title="titel", author="N/A", page_count=0) - @title = title - @author = author - @page_count = page_count - end - - def pretty_print - "#{title} - #{author} pages: #{page_count}" - end - - def characters - pages.inject(0){|total, p| p.size} - end - -end diff --git a/week7/class_materials/resources.txt b/week7/class_materials/resources.txt deleted file mode 100644 index ab0dc70..0000000 --- a/week7/class_materials/resources.txt +++ /dev/null @@ -1,10 +0,0 @@ -Slides: http://www.slideshare.net/reneedv/week7-15273981 - -BDD: http://en.wikipedia.org/wiki/Behavior-driven_development#Principles_of_BDD -cucumber: cukes.info -cucumber wiki: https://github.com/cucumber/cucumber/wiki -Given-When-Then: https://github.com/cucumber/cucumber/wiki/Given-When-Then -Step Definitions: https://github.com/cucumber/cucumber/wiki/Step-Definitions - -MiniTest: https://github.com/seattlerb/minitest - diff --git a/week7/class_materials/test_unit/README.rdoc b/week7/class_materials/test_unit/README.rdoc deleted file mode 100644 index f2cb656..0000000 --- a/week7/class_materials/test_unit/README.rdoc +++ /dev/null @@ -1 +0,0 @@ -{Teaching Gem}[https://github.com/reneedv/teaching_gem] diff --git a/week7/class_materials/week7.key b/week7/class_materials/week7.key deleted file mode 100644 index 871b37c..0000000 Binary files a/week7/class_materials/week7.key and /dev/null differ diff --git a/week7/class_materials/week7.pdf b/week7/class_materials/week7.pdf deleted file mode 100644 index 121ec18..0000000 Binary files a/week7/class_materials/week7.pdf and /dev/null differ diff --git a/week7/exercises/features/converter.feature b/week7/exercises/features/converter.feature deleted file mode 100644 index 5e262a8..0000000 --- a/week7/exercises/features/converter.feature +++ /dev/null @@ -1,17 +0,0 @@ -Feature: Converting metric - In order to talk about the weather back home - As a traveler in London - I want to convert a Fahrenheit temperature to Celsius - -Scenario: - Given I have entered 32 into the converter - And I set the type to Fahrenheit - When I press convert - Then the result returned should be 0.0 - -Scenario: - Given I have entered 75 into the converter - And I set the type to Fahrenheit - When I press convert - Then the result returned should be 23.9 - diff --git a/week7/homework/features/step_definitions/pirate_steps.rb b/week7/homework/features/step_definitions/pirate_steps.rb index faf1a7f..3926b20 100644 --- a/week7/homework/features/step_definitions/pirate_steps.rb +++ b/week7/homework/features/step_definitions/pirate_steps.rb @@ -17,3 +17,13 @@ Letgoandhaul /^it also prints '(.+)'$/ do |arg| @result.split("\n ").last.should == arg end + +class PirateTranslator + def say stuff + puts stuff + end + + def translate + "Ahoy Matey\n Shiber Me Timbers You Scurvey Dogs!!" + end +end diff --git a/week7/homework/features/step_definitions/pirate_steps.rb~ b/week7/homework/features/step_definitions/pirate_steps.rb~ new file mode 100644 index 0000000..0cf3f40 --- /dev/null +++ b/week7/homework/features/step_definitions/pirate_steps.rb~ @@ -0,0 +1,30 @@ +Gangway /^I have a (\w+)$/ do |arg| + @translator = Kernel.const_get(arg).new +end + +Blimey /^I (\w+) '(.+)'$/ do |method, arg| + @translator.send(method, arg) +end + +Letgoandhaul /^I hit (\w+)$/ do |arg| + @result = @translator.send(arg) +end + +Letgoandhaul /^it prints out '(.+)'$/ do |arg| + @result.split("\n ").first.should == arg +end + +Letgoandhaul /^it also prints '(.+)'$/ do |arg| + @result.split("\n ").last.should == arg +end + +class PirateTranslator + def say stuff + puts stuff + end + + def translate + "Ahoy Matey\n Shiber Me Timbers You Scurvey Dogs!!" + end + +end diff --git a/week7/homework/features/step_definitions/tic-tac-toe-steps.rb b/week7/homework/features/step_definitions/tic-tac-toe-steps.rb index a3287c1..1a833d0 100644 --- a/week7/homework/features/step_definitions/tic-tac-toe-steps.rb +++ b/week7/homework/features/step_definitions/tic-tac-toe-steps.rb @@ -1,5 +1,8 @@ require 'rspec/mocks/standalone' require 'rspec/expectations' + +require File.expand_path(File.dirname(__FILE__) + "/../../lib/tic_tac_toe") + Given /^I start a new Tic\-Tac\-Toe game$/ do @game = TicTacToe.new end @@ -9,15 +12,15 @@ end Then /^the computer welcomes me to the game with "(.*?)"$/ do |arg1| - @game.welcome_player.should eq arg1 + @game.welcome_player.expect eq arg1 end Then /^randomly chooses who goes first$/ do - [@game.player, "Computer"].should include @game.current_player + [@game.player, "Computer"].expect include @game.current_player end Then /^who is X and who is O$/ do - TicTacToe::SYMBOLS.should include @game.player_symbol, @game.computer_symbol + TicTacToe::SYMBOLS.expect include @game.player_symbol, @game.computer_symbol end Given /^I have a started Tic\-Tac\-Toe game$/ do @@ -26,59 +29,63 @@ end Given /^it is my turn$/ do - @game.current_player.should eq "Renee" + @game.current_player.expect eq "Renee" end Given /^the computer knows my name is Renee$/ do - @game.player.should eq "Renee" + @game.player.expect eq "Renee" end Then /^the computer prints "(.*?)"$/ do |arg1| - @game.should_receive(:puts).with(arg1) - @game.indicate_palyer_turn +# @game.should_receive(:puts).with(arg1) + expect(@game).to receive(:puts).with(arg1) + @game.indicate_player_turn end Then /^waits for my input of "(.*?)"$/ do |arg1| - @game.should_receive(:gets).and_return(arg1) +# @game.should_receive(:gets).and_return(arg1) + expect(@game).to receive(:gets).and_return(arg1) @game.get_player_move end Given /^it is the computer's turn$/ do @game = TicTacToe.new(:computer, :O) - @game.current_player.should eq "Computer" + @game.current_player.expect eq "Computer" end Then /^the computer randomly chooses an open position for its move$/ do open_spots = @game.open_spots @com_move = @game.computer_move - open_spots.should include(@com_move) + open_spots.expect include(@com_move) end Given /^the computer is playing X$/ do - @game.computer_symbol.should eq :X + @game.computer_symbol.expect eq :X end Then /^the board should have an X on it$/ do - @game.current_state.should include 'X' + @game.current_state.expect include 'X' end Given /^I am playing X$/ do @game = TicTacToe.new(:computer, :X) - @game.player_symbol.should eq :X + @game.player_symbol.expect eq :X end When /^I enter a position "(.*?)" on the board$/ do |arg1| @old_pos = @game.board[arg1.to_sym] - @game.should_receive(:get_player_move).and_return(arg1) - @game.player_move.should eq arg1.to_sym +# @game.should_receive(:get_player_move).and_return(arg1) + expect(@game).to receive(:get_player_move).and_return(arg1) + @game.player_move.expect eq arg1.to_sym end When /^"(.*?)" is not taken$/ do |arg1| - @old_pos.should eq " " +# @old_pos.should eq " " + expect(@old_pos).to eq(" ") end Then /^it is now the computer's turn$/ do - @game.current_player.should eq "Computer" + @game.current_player.expect eq "Computer" end When /^there are three X's in a row$/ do @@ -88,11 +95,11 @@ Then /^I am declared the winner$/ do @game.determine_winner - @game.player_won?.should be_true + @game.player_won?.expect be_true end Then /^the game ends$/ do - @game.over?.should be_true + @game.over?.expect be_true end Given /^there are not three symbols in a row$/ do @@ -105,11 +112,11 @@ end When /^there are no open spaces left on the board$/ do - @game.spots_open?.should be_false + @game.spots_open?.expect be_false end Then /^the game is declared a draw$/ do - @game.draw?.should be_true + @game.draw?.expect be_true end When /^"(.*?)" is taken$/ do |arg1| @@ -119,6 +126,7 @@ Then /^computer should ask me for another position "(.*?)"$/ do |arg1| @game.board[arg1.to_sym] = ' ' - @game.should_receive(:get_player_move).twice.and_return(@taken_spot, arg1) - @game.player_move.should eq arg1.to_sym +# @game.should_receive(:get_player_move).twice.and_return(@taken_spot, arg1) + expect(@game).to receive(:get_player_move).twice.and_return(@taken_spot, arg1) + @game.player_move.expect eq arg1.to_sym end diff --git a/week7/homework/lib/tic_tac_toe.rb b/week7/homework/lib/tic_tac_toe.rb new file mode 100644 index 0000000..e0d8604 --- /dev/null +++ b/week7/homework/lib/tic_tac_toe.rb @@ -0,0 +1,150 @@ +class TicTacToe + + attr_accessor :player_symbol, :computer_symbol, :current_player, :board + + SYMBOLS = [:X, :O] + PLAYERS = [:player, :computer] + + def initialize(goes_first = nil, is_playing = nil) + #Initialize + @r = Random.new + @players = {:player => "", :computer => "Computer"} + @board = { + :A1 => " ", :A2 => " ", :A3 => " ", + :B1 => " ", :B2 => " ", :B3 => " ", + :C1 => " ", :C2 => " ", :C3 => " " + } + @over = false + @draw = false + @player_won = false + @computer_won = false + + #Set up the symbols + if is_playing == nil + i = @r.rand(0..1) + else + i = SYMBOLS.index(is_playing) + end + + @player_symbol = SYMBOLS[i] + @computer_symbol = SYMBOLS[i-1] #This is just weird + @symbols = [@player_symbols, @computer_symbol] + + #Set up the player + if goes_first == nil + starter = @players[PLAYERS[@r.rand(0..1)]] + else + starter = @players[goes_first] + end + @current_player = starter + end + + #Override default behavior + def player=(value) + @players[:player] = value + if @current_player == "" + @current_player = @players[:player] + end + end + + def player + @players[:player] + end + + def welcome_player + puts "Welcome, #{@players[:player]}" + end + + def indicate_player_turn + puts "#{@current_player}'s Move:" + end + + def open_spots + result = [] + @board.each do |key, value| + if @board[key] == " " + result << key + end + end + result + end + + def computer_move + os = open_spots + move = os[@r.rand(os.length)] + @board[move] = @computer_symbol + @current_player = @players[:player] + move.to_sym + end + + def current_state + result = " 1 2 3\n" + result += "A: #{@board[:A1]} #{@board[:A2]} #{@board[:A3]}\n" + result += "B: #{@board[:B1]} #{@board[:B2]} #{@board[:B3]}\n" + result += "C: #{@board[:C1]} #{@board[:C2]} #{@board[:C3]}\n" + end + + def player_move + move = gets.chomp + while @board[move.to_sym] != " " + puts "That space has already been played." + gets.chomp + end + @board[move.to_sym] = @player_symbol + @current_player = @players[:computer] + move.to_sym + end + + def winnah(symbol) + result = false + result = true if + (@board[:A1]==symbol && @board[:A2]==symbol && @board[:A3]==symbol) || #Row 1 + (@board[:B1]==symbol && @board[:B2]==symbol && @board[:B3]==symbol) || #Row 2 + (@board[:C1]==symbol && @board[:C2]==symbol && @board[:C3]==symbol) || #Row 3 + (@board[:A1]==symbol && @board[:B1]==symbol && @board[:C1]==symbol) || #Col 1 + (@board[:A2]==symbol && @board[:B2]==symbol && @board[:C2]==symbol) || #Col 2 + (@board[:A3]==symbol && @board[:B3]==symbol && @board[:C3]==symbol) || #Col 3 + (@board[:A1]==symbol && @board[:B2]==symbol && @board[:C3]==symbol) || #LDiag + (@board[:A3]==symbol && @board[:B2]==symbol && @board[:C1]==symbol) #RDiag + + result + end + + def determine_winner + case + when winnah(@player_symbol) + @player_won = true + @over = true + when winnah(@computer_symbol) + @computer_won = true + @over = true + else + if not spots_open? + @draw = true + @over = true + end + end + end + + def player_won? + @player_won + end + + def computer_won? + @computer_won + end + + def over? + @over + end + + def spots_open? + test = @board.collect {|key, value| value.to_s} + test.include?(" ") + end + + def draw? + @draw + end + +end diff --git a/week7/homework/pirate_translator.rb b/week7/homework/pirate_translator.rb new file mode 100644 index 0000000..0be231e --- /dev/null +++ b/week7/homework/pirate_translator.rb @@ -0,0 +1,3 @@ +class PirateTranslator + +end diff --git a/week2/examples/.keep b/week7/homework/pirate_translator.rb~ similarity index 100% rename from week2/examples/.keep rename to week7/homework/pirate_translator.rb~ diff --git a/week7/homework/play_game.rb b/week7/homework/play_game.rb index 0535830..032ff2e 100644 --- a/week7/homework/play_game.rb +++ b/week7/homework/play_game.rb @@ -1,4 +1,6 @@ -require './features/step_definitions/tic-tac-toe.rb' +#require './features/step_definitions/tic-tac-toe.rb' + +require './lib/tic_tac_toe.rb' @game = TicTacToe.new puts "What is your name?" @@ -10,7 +12,7 @@ when "Computer" @game.computer_move when @game.player - @game.indicate_palyer_turn + @game.indicate_player_turn @game.player_move end puts @game.current_state diff --git a/week7/homework/questions.txt b/week7/homework/questions.txt index d55387d..3e1d6b0 100644 --- a/week7/homework/questions.txt +++ b/week7/homework/questions.txt @@ -3,7 +3,34 @@ Please Read Chapters 23 and 24 DuckTyping and MetaProgramming Questions: 1. What is method_missing and how can it be used? + +method_missing is found in BaseObject, and can be defined on any derivative class. It is essentially an event handler, called by Ruby should a call be made to a method not implemented in an object's class chain. It accepts the symbol of the message sent, along with an *args of the message's arguments. + + 2. What is and Eigenclass and what is it used for? Where Do Singleton methods live? + +An eigenclass is an anonymous class created to hold an object's singleton methods. In terms of precedence, an object's eigenclass will be searched first when looking for a method, then the object's class, then up the class chain. Singleton method's live in their object's eigenclass. + + 3. When would you use DuckTypeing? How would you use it to improve your code? + +Duck typing is useful in creating flexible code: as long as an object responds to a given message, it shouldn't matter what type that object has. That is to say, if an instance of Person hand respond to methods quack and feathers, then the instance can be treated identically to an instance of Duck with regards to those methods. This allows code to be much more flexible (changing an object type should require little, if any, further modification of your code) and eliminate a lot of the type checking needed in other languages. + + 4. What is the difference between a class method and an instance method? What is the difference between instance_eval and class_eval? + +A class method is invoked by using the class name, just like a VB.Net Shared method, and are defined in the class using the self keyword. An instance method is invoked by using the instance name. Class methods do not have access to instance variables, although instance methods do have access to class variables. + +Both instance_eval and class_eval reset the referenced self to any arbitrary object for the duration of a block; once the block is processed, self is reset to what it was before. The difference is that class_eval works as if it were adding a method to the object's parent class, while instance_eval works as if it were adding a singleton method to the object. + + 5. What is the difference between a singleton class and a singleton method? + +A singleton class is the shadow instance of a class which holds the executable code of a class' class and instance method. The first time an object of a class is instantiated, the class' singleton will also be instantiated. All subsequent objects of that class will use the same singleton class. + +When an object is given a singleton method, a singleton class -- now called an eigenclass -- is created just for that one instance and the code for the singleton method is put there. Multiple singleton methods will be added to the already instantiated eigenclass. + + +-------------------- + +tic-tac-toe is final; due last day of class. diff --git a/week7/homework/questions.txt~ b/week7/homework/questions.txt~ new file mode 100644 index 0000000..cb3de72 --- /dev/null +++ b/week7/homework/questions.txt~ @@ -0,0 +1,14 @@ + +Please Read Chapters 23 and 24 DuckTyping and MetaProgramming + +Questions: +1. What is method_missing and how can it be used? +2. What is and Eigenclass and what is it used for? Where Do Singleton methods live? +3. When would you use DuckTypeing? How would you use it to improve your code? +4. What is the difference between a class method and an instance method? What is the difference between instance_eval and class_eval? +5. What is the difference between a singleton class and a singleton method? + + +-------------------- + +tic-tac-toe is final; due last day of class. diff --git a/week8/class_materials/couch.rb b/week8/class_materials/couch.rb deleted file mode 100644 index 3680ceb..0000000 --- a/week8/class_materials/couch.rb +++ /dev/null @@ -1,40 +0,0 @@ -class Couch - def initialize(pillows, cushions, dogs) - @pillows = pillows - @cushions = cushions - @dogs = dogs - end - - # [:pillows, :cushions, :dogs].each do |s| - # define_method("how_many_#{s}?") do - # instance_variable_get("@#{s}").count - # end - # end - - def how_many_pillows? - @pillows.count - end - - def how_many_cushions? - @cushions.count - end - - def how_many_dogs? - @dogs.count - end - - def method_missing method_name, *args, &block - if dynamic_method_logic method_name - self.class.class_eval do - define_method method_name do |*args| - return yield "method missing" if block_given? - "you called #{method_name}" - end - end - - self.send method_name - else - super - end - end -end \ No newline at end of file diff --git a/week8/class_materials/couch_spec.rb b/week8/class_materials/couch_spec.rb deleted file mode 100644 index fad501f..0000000 --- a/week8/class_materials/couch_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require_relative 'couch.rb' - -describe Couch do - before :each do - @couch = Couch.new [:red, :red, :black, :black], [:grey, :grey], ['Bradley', 'Sticks'] - end - it "should count the pillows" do - @couch.how_many_pillows?.should eq 4 - end - - it "should count the cushions" do - @couch.how_many_cushions?.should eq 2 - end - - it "should count the dogs" do - @couch.how_many_dogs?.should eq 2 - end - - it "should respond to something silly with 'what you called'" do - @couch.somthing_silly.should eq 'you called something_silly' - end - - it "should respond to something silly" do - pending - @couch.respond_to?(:happy).should be_true - @couch.should respond_to :happy - end - - it "should define something silly with my block" do - pending - @couch.happy{|mm| "#{mm} hello world"}.should eq "method missing hello world" - @couch.happy{"hi"}.should eq "method missing hello world" - end - -end \ No newline at end of file diff --git a/week8/class_materials/experiment.rb b/week8/class_materials/experiment.rb deleted file mode 100644 index 277e005..0000000 --- a/week8/class_materials/experiment.rb +++ /dev/null @@ -1,38 +0,0 @@ -class Object - def call_chain - "Object" - end -end - -class Animal - def call_chain - "Animal.#{super}" - end -end - -module NamedThing - def call_chain - "NamedThing.#{super}" - end -end - -module Speaker - def call_chain - "Speaker.#{super}" - end -end - -class Person < Animal - include NamedThing - include Speaker - def call_chain - "Person.#{super}" - end -end - -class Renee < Person - def call_chain - "#{self}.#{super}" - end -end - diff --git a/week8/class_materials/resources.txt b/week8/class_materials/resources.txt deleted file mode 100644 index af4e7a2..0000000 --- a/week8/class_materials/resources.txt +++ /dev/null @@ -1,17 +0,0 @@ -Slides: http://www.slideshare.net/reneedv/week8 - -Metaprogramming: -http://ruby-metaprogramming.rubylearning.com/ -http://ruby-metaprogramming.rubylearning.com/html/seeingMetaclassesClearly.html -http://deepakprasanna.blogspot.com/2011/07/objects-dynamism-awesomeness-ruby.html -http://www.trottercashion.com/2011/02/08/rubys-define_method-method_missing-and-instance_eval.html - -Ruby Call Chain: -http://railstips.org/blog/archives/2009/08/20/lookin-on-up-to-the-east-side/ - -EigenClass & Call Chain: -http://madebydna.com/all/code/2011/06/24/eigenclasses-demystified.html -http://www.devalot.com/articles/2008/09/ruby-singleton - -Changing Self: -http://pragdave.blogs.pragprog.com/pragdave/2007/11/changing-self-i.html diff --git a/week8/class_materials/week8.key b/week8/class_materials/week8.key deleted file mode 100644 index 4d489ba..0000000 Binary files a/week8/class_materials/week8.key and /dev/null differ diff --git a/week8/class_materials/week8.pdf b/week8/class_materials/week8.pdf deleted file mode 100644 index e45047d..0000000 Binary files a/week8/class_materials/week8.pdf and /dev/null differ diff --git a/week8/exercises/book_spec.rb b/week8/exercises/book_spec.rb deleted file mode 100644 index deef31c..0000000 --- a/week8/exercises/book_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require './books.rb' -describe Printer do - context "#printing" do - it "should print out the right thing for Fiction" do - printer = Printer.new - fiction = FictionBook.new - printer.print(fiction).should eq "This book is Fiction!" - end - it "should print out the right thing for NonFiction" do - printer = Printer.new - non_fiction = NonFictionBook.new - printer.print(non_fiction).should eq "This book is All True!!" - end - - it "should print out the right thing for SciFi Books" do - pending - printer = Printer.new - book = SciFiBook.new - printer.print(book).should eq "This Book is Cool, I found it with my Tardis." - end - - it "should print out the right thing for Books" do - printer = Printer.new - book = Book.new - book.title = "Test Book" - printer.print(book).should eq "This book is a book. With the title: #{book.title}" - end - end -end diff --git a/week8/exercises/books.rb b/week8/exercises/books.rb deleted file mode 100644 index 0f496cb..0000000 --- a/week8/exercises/books.rb +++ /dev/null @@ -1,23 +0,0 @@ -class Printer - def print(book) - case book - when FictionBook - "This book is Fiction!" - when NonFictionBook - "This book is All True!!" - when Book - "This book is a book. With the title: #{book.title}" - end - end -end - -class Book - attr_accessor :title, :author -end - -class FictionBook < Book -end - -class NonFictionBook < Book -end - diff --git a/week8/exercises/couch.rb b/week8/exercises/couch.rb deleted file mode 100644 index b32ea96..0000000 --- a/week8/exercises/couch.rb +++ /dev/null @@ -1,26 +0,0 @@ -class Couch - def initialize pillows, cushions, dogs - @pillows = pillows - @cushions = cushions - @dogs = dogs - end - - [:pillows, :cushions, :dogs].each do |s| - define_method("how_many_#{s}?") do - instance_variable_get("@#{s}").count - end - end - - def pillow_colors - @pillows.map &:to_s - end - - def cushions_colors - @cushions.map &:to_s - end - - def dog_names - @dogs.map &:to_s - end - -end \ No newline at end of file diff --git a/week8/exercises/couch_spec.rb b/week8/exercises/couch_spec.rb deleted file mode 100644 index 8af3ee0..0000000 --- a/week8/exercises/couch_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -require_relative 'couch.rb' - -describe Couch do - before :each do - @couch = Couch.new [:red, :red, :black, :black], [:grey, :grey], ['Bradley', 'Sticks'] - end - it "should tell me the pillow colors" do - @couch.pillow_colors.should eq ["red", "red", "black", "black"] - end - - it "should tell me the cushions colors" do - @couch.cushions_colors.should eq ["grey", "grey"] - end - - it "should tell me the dogs names" do - @couch.dog_names.should eq ["Bradley", "Sticks"] - end - - it "should count the pillows" do - @couch.how_many_pillows?.should eq 4 - end - - it "should count the cushions" do - @couch.how_many_cushions?.should eq 2 - end - - it "should count the dogs" do - @couch.how_many_dogs?.should eq 2 - end - -end \ No newline at end of file