Skip to content

Commit

Permalink
Implement hello-world in ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
Sgoettschkes committed Nov 24, 2023
1 parent 29f6acb commit fd630f1
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 0 deletions.
54 changes: 54 additions & 0 deletions ruby/hello-world/HELP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Help

## Running the tests

For running the tests provided, you will need the Minitest gem. Open a
terminal window and run the following command to install minitest:

```
gem install minitest
```


Run the tests from the exercise directory using the following command:

```
ruby <snake-case-exercise>_test.rb
```

Please replace `<snake-case-exercise>` with your exercise name in snake_case.

## Color output

You can `require 'minitest/pride'` or run the following command to get colored output:

```
ruby -r minitest/pride <snake-case-exercise>_test.rb
```

## Submitting your solution

You can submit your solution using the `exercism submit hello_world.rb` command.
This command will upload your solution to the Exercism website and print the solution page's URL.

It's possible to submit an incomplete solution which allows you to:

- See how others have completed the exercise
- Request help from a mentor

## Need to get help?

If you'd like help solving the exercise, check the following pages:

- The [Ruby track's documentation](https://exercism.org/docs/tracks/ruby)
- The [Ruby track's programming category on the forum](https://forum.exercism.org/c/programming/ruby)
- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5)
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs)

Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.

To get help if you're having trouble, you can use one of the following resources:

- [Ruby Documentation](http://ruby-doc.org/)
- [StackOverflow](http://stackoverflow.com/questions/tagged/ruby)
- [/r/ruby](https://www.reddit.com/r/ruby) is the Ruby subreddit.
52 changes: 52 additions & 0 deletions ruby/hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Hello World

Welcome to Hello World on Exercism's Ruby Track.
If you need help running the tests or submitting your code, check out `HELP.md`.

## Instructions

The classical introductory exercise.
Just say "Hello, World!".

["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment.

The objectives are simple:

- Modify the provided code so that it produces the string "Hello, World!".
- Run the test suite and make sure that it succeeds.
- Submit your solution and check it at the website.

If everything goes well, you will be ready to fetch your first real exercise.

[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program

## Source

### Created by

- @ramonh

### Contributed to by

- @abartov
- @bgrabow
- @budmc29
- @gilmatic
- @hilary
- @iHiD
- @Insti
- @jpotts244
- @Kosmas
- @kotp
- @kytrinyx
- @mike-hewitson
- @NeimadTL
- @sivabudh
- @skeskali
- @thejoycekung
- @trayo
- @tryantwit

### Based on

This is an exercise to introduce users to using Exercism - https://en.wikipedia.org/wiki/%22Hello,_world!%22_program
5 changes: 5 additions & 0 deletions ruby/hello-world/hello_world.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class HelloWorld
def self.hello
"Hello, World!"
end
end
9 changes: 9 additions & 0 deletions ruby/hello-world/hello_world_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'minitest/autorun'
require_relative 'hello_world'

class HelloWorldTest < Minitest::Test
def test_say_hi
# skip
assert_equal "Hello, World!", HelloWorld.hello
end
end

0 comments on commit fd630f1

Please sign in to comment.