Giter Club home page Giter Club logo

ruby-exercises's Introduction

Ruby Exercises

This is a collection of exercises to practice various aspects of Ruby.

Practicing in this manner (small, bite-sized problems that you can do repeatedly) is a fantastic way to solidify programming concepts.

Each folder in this repository is a set of related exercises. Open up the folder and read the README to learn more about them.

Structure of this repository

  • Each folder contains a README.md file that provides a summary of what skills you will develop with these exercises
  • Each exercise file within the folder will begin with comments providing more detail on:
    1. How you need to manipulate or work with this file to complete the exercise.
    2. Some exercises will require you to manipulate the "current" file and run it. Other exercises will require you to create new files and then reference those files for the "current" file to work.

If you're new here, watch this getting-started video. We'll install the ruby-exercises directory, figure out how to get set up to practice some ruby, and then we'll work through the complete full exercises:

Intro to ruby-exercises and strings.rb (YouTube)

Setup

1. Clone this repository

You don't need to fork this repository; clone it to your laptop

in your /turing directory on your laptop (or whatever directory you want this repository to live inside of), run:

// using ssh keys
git clone [email protected]:turingschool/ruby-exercises.git
// using https, if the above doesn't work:
git clone https://github.com/turingschool/ruby-exercises.git

Once this command runs, you'll now have a "local" copy of this entire repository, living right on your laptop.

2. From the command line, cd into the ruby-exercises directory.

2. Install bundler gem

run gem install bundler in your terminal

3. From the command line, run bundle install

You should see something like this:

$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Using bundler 2.1.4
Fetching coderay 1.1.2
Installing coderay 1.1.2
Fetching method_source 1.0.0
Installing method_source 1.0.0
Fetching minitest 5.2.1
Installing minitest 5.2.1
Fetching pry 0.13.1
Installing pry 0.13.1
Bundle complete! 2 Gemfile dependencies, 5 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

If you see that, great!

If you get an error like:

zsh: command not found: bundle

you need to install the bundler gem. Run:

$ gem install bundler

If this command throws an error, you either:

  1. Don't have rbenv installed
  2. You've not yet installed a version of Ruby.

Please check that you've followed mod0 setup instructions and this guide to install rbenv and a version of ruby.

Hey, hold up. What is this bundle thing, and what does it do? what does gem install bundler do?

Great question!

bundler is Ruby's package manager. If you want to install extra code that works with Ruby, you'll use bundler to do it. Once you have the bundler installed, it is "used" by typing bundle into your terminal.

It is used in conjunction with the Gemfile and Gemfile.lock files you see in this repository, to manage Ruby gems.

Here's an exhaustive amount of information about gems, if you're so inclined: guides.rubygems.org/what-is-a-gem


Once bundle has run successfully, open up the first test!

$ cd data-types/strings
$ atom .

And read through the README.md for further instructions!

If you want to view the instructions in your web browser, you can view them here: data-types/strings/README.md

Otherwise, please work through this video guide to fully understand how to run these exercises. They can be mostly self-explanitory, but even if you know exactly how to make these tests pass, you'll gain value from the video.


Suggested order

This repository of exercises is one of the best tools you've got to learn Ruby. Every minute spent here is time very well spent.

  • Week 1

  • Week 2

    • data-types/collections/hashes.rb
    • objects-and-methods/exercise-1
    • mythical-creatures
    • command-query
      • leather_chair_test.rb
      • baby_test.rb
      • beers_test.rb
  • Week 3

    • datatypes/collections/advanced_nested_collections.rb video walk-through
    • object-and-methods/exercise-2
    • mythical-creatures
      • Medusa
      • Werewolf
      • Centaur
      • Ogre
    • command-query
      • adult_test.rb
      • roll_call_test.rb
      • wallet_test.rb
  • Week 4+

    • Enumerables/exercises
    • Iteration
    • Command and Query
    • Complete/Redo Mythical Creatures

ruby-exercises's People

Contributors

brianzanti avatar josh-works avatar kytrinyx avatar timomitchel avatar jcasimir avatar mikedao avatar s-espinosa avatar aliyamerali avatar memcmahon avatar zdcthomas avatar joshcheek avatar dunlapww avatar megstang avatar danieleframpton avatar jake0miller avatar victoriavasys avatar mjc avatar worace avatar mikez321 avatar novohispano avatar hhoopes avatar gkhalsa avatar aziobrow avatar agsiegert avatar alischlereth avatar adriennedomingus avatar bad6e avatar dglunz avatar georgiegirl24 avatar jbrr avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.