Skip to content

Commit

Permalink
Add: ruby Hexlet example code | test
Browse files Browse the repository at this point in the history
  • Loading branch information
vovs03 committed May 24, 2022
1 parent f8d3c3e commit 03b159f
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ruby/lessons/2_hexlet/app/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

gem 'open3'

group :test do
gem 'minitest',
gem 'minitest-reporters', '>= 1.1.7'
end
15 changes: 15 additions & 0 deletions ruby/lessons/2_hexlet/app/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
GEM
remote: https://rubygems.org/
specs:
minitest (5.15.0)
open3 (0.1.1)

PLATFORMS
ruby

DEPENDENCIES
minitest
open3

BUNDLED WITH
1.17.3
5 changes: 5 additions & 0 deletions ruby/lessons/2_hexlet/app/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console:
@ruby-console

test:
ruby test.rb
5 changes: 5 additions & 0 deletions ruby/lessons/2_hexlet/app/solution.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

# BEGIN (write your solution here)
puts 'Hello, World!'
# END
17 changes: 17 additions & 0 deletions ruby/lessons/2_hexlet/app/test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

require 'minitest'
require 'minitest/power_assert'
require 'minitest/autorun'
#require 'open3'
require_relative './solution'

class SolutionTest < Minitest::Test
def test_solution
o, _e, = Open3.capture3('ruby solution.rb')

result = o.chomp

assert { result == 'Hello, World!' }
end
end
57 changes: 57 additions & 0 deletions ruby/lessons/bh-003_001.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Ruby

> 2022-05-12 10:07
> (отставание по графику 27 мин)
## Теория

- [Введение в программирование. Ruby](https://learn.dualboot.ru/courses/5/lessons/74/theories)

глянул* TDD

## Узнал
- [Введение в Ruby](https://ru.hexlet.io/courses/ruby)

4 способа запуска кода руби локально

1. `ruby test.rb`
2. `ruby -e 'puts "Ruby is alive!"'` 🍊
3. `irb`
4. `pry`

##

Правила

1. Классы не могут содержать больше чем 100 строк кода.
2. Методы не могут быть длиннее чем 5 строк кода.
3. Нельзя передавать больше 4 параметров в метод. Значения хэша также считаются параметрами.
4. Контроллеры могут инстанциировать только один объект. Следовательно, представление может знать только об одной инстанс переменной и должно только слать сообщения этому объекту (`@object.collaborator.value` не допустим).


## Числа

https://ru.hexlet.io/courses/ruby/lessons/ruby_numbers/theory_unit

- [x] https://ru.hexlet.io/code_reviews/575656#tips

---

### 🐛 Поиск ошибок в коде

> source: `https://ru.hexlet.io/code_reviews/575656#tips`
Шаги, которые выполняют программисты для поиска ошибок в коде

- [ ] Найдите сообщение об ошибке в выводе. Попробуйте перевести его и понять.
- [ ] Изучите [стектрейс](https://en.wikipedia.org/wiki/Stack_trace), [🇷🇺 Трассировка стека](https://ru.wikipedia.org/wiki/Трассировка_стека), найдите указание на файл и строку, где произошла ошибка. Откройте файл, проанализируйте код вокруг.
- [ ] Посмотрите, как вызывается ваш код в тестах, какие данные в него передаются.
- [ ] Убедитесь, что вы не пропустили ничего в описании задания. В конце бывают подсказки.
- [ ] Прочитайте обсуждения конкретного урока, возможно, там есть разбор некоторых ошибок.

---

## Задачи

[x] Выполнил 2 задачи https://ru.hexlet.io/courses/ruby/lessons/ruby_numbers/theory_unit

4 changes: 4 additions & 0 deletions ruby/lessons/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# 2022-05-12 10:35

ruby -e 'puts "Ruby is alive!"'
10 changes: 10 additions & 0 deletions ruby/sources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Sources

## Books

## Courses

- [ ] [Введение в программирование. Ruby](https://learn.dualboot.ru/courses/5/lessons/74/theories)
- [x] [TDD](https://ru.wikipedia.org/wiki/Разработка_через_тестирование)

- [ ] [Введение в Ruby](https://ru.hexlet.io/courses/ruby)

0 comments on commit 03b159f

Please sign in to comment.