This repository has been archived by the owner on Jun 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
2370-1 #134
Open
AntonNaumchik
wants to merge
73
commits into
rubizza-camp:master
Choose a base branch
from
AntonNaumchik:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
2370-1 #134
Changes from 68 commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
63c756d
2294-0
DenisVolchek 7f8309a
Add video and 1.rb for task 0.
LikaLex 23b7ef5
codestyle
DenisVolchek 0e34e2f
Remove video.
LikaLex a27bb6f
trailing blank line
DenisVolchek e1e54c3
changed directories
DenisVolchek c8c6cf1
Move file to the task specific folder.
LikaLex e875a92
Merge pull request #5 from LikaLex/2199/0
dad8934
Merge pull request #7 from DenisVolchek/2294-0
def5f9b
Implement hw-0
SashaShostyr b0f1297
Merge pull request #8 from SashaShostyr/hw-0
81bb64d
2227-0
VladislavIlyuschits 9f4fd4d
2211-0
TanyaAkulich d56f355
refactored folder structure
VladislavIlyuschits 01b6664
added task 0 for 2263
ARtoriouSs c56de35
add 1.rb
67c360e
change branch
c58902a
added final newline to 1.rb
ARtoriouSs 319a79e
Add the first task
andreydro 92f704e
2223-0
VDmitryO 659909b
Create 1.rb
misterOlrox 33d9e33
created 1.rb
idealasgas 16a0b07
Create personal folder
krlklim c28bc65
Merge pull request #9 from VladislavIlyuschits/2227-0
ad8ba40
Merge pull request #10 from TanyaAkulich/0
95787ab
completed homework 0
JacksonBaltramovich b310d6f
2256 - 0
v-kazantsev aa01806
Complete task
8617430
Merge pull request #24 from idealasgas/zerotask
5db2006
Create a .rb file with text
v-kazantsev 51ad0d1
Merge pull request #29 from Phin89/2241/0
0fd4534
Merge pull request #28 from v-kazantsev/0
25cbc88
Merge pull request #27 from JacksonBaltramovich/2213-0
93e2c6b
Merge pull request #20 from krlklim/2249/0
f7a0958
Merge pull request #11 from ARtoriouSs/0
46391ba
Merge pull request #19 from misterOlrox/misterOlrox-patch-1
9311097
Merge pull request #15 from ZhenyaZhak/2232-0
da6219e
implement hw-0
8b50b6f
Merge pull request #18 from andreydro/2226/0
e4cca52
Initial commit
Aleksei12942 7b61f82
Create 1.rb
lstpsche 7445eee
Create 1.rb
shamritskiy3468 73aef52
Update 1.rb
lstpsche 1c01273
create 1.rb
brutu33 2125c03
Create 1.rb
adf10d7
Add file 1.rb
867baef
Remove unnecessary files
37b5502
Merge pull request #33 from DSummerduck/master
42de175
Merge pull request #34 from shamritskiy3468/2197/0
dc017bb
implement hw0
c64c1e0
Merge pull request #25 from nikitasakov/2214-0
007fe2c
Merge pull request #32 from lstpsche/master
4b52559
Merge pull request #31 from ilya-github/master
ceb1a87
Merge pull request #21 from VDmitryO/2223-0
1ef8dc0
Merge pull request #36 from Vadser/homework-0
8c6671a
Merge pull request #35 from brutu33/master
4b86da0
task 0
reedzyy bca5771
Merge pull request #39 from leshkacore/2333
bbbace6
Add final newline
Aleksei12942 ed96605
Merge pull request #26 from Aleksei12942/first_task
ab62b2c
Create 1.rb
AntonNaumchik 692040f
Create about_array_assignment.rb
AntonNaumchik 7bbf7a9
Fixed files
AntonNaumchik 540f057
Fix corrupted files
AntonNaumchik a6beeeb
Delete .reek
AntonNaumchik 843d47b
Delete .todo.reek
AntonNaumchik d409d7b
Fix rubocop issues
AntonNaumchik 6308e2f
Merge branch 'master' of https://github.com/AntonNaumchik/summer-2018
AntonNaumchik 62a1736
Add top-level comment to about_array_assignment.rb
AntonNaumchik f0025d0
Fix about_asserts.rb rubocop issues
AntonNaumchik b3c27cb
fix about_message_passinf.rb
AntonNaumchik 6b26409
fix about_message_passing.rb
AntonNaumchik fd61152
Merge branch 'master' of github.com:rubizza-survival-camp/summer-2018
AntonNaumchik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts 'Chunky bacon' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/neo') | ||
|
||
class AboutArrayAssignment < Neo::Koan | ||
def test_non_parallel_assignment | ||
names = %w[John Smith] | ||
assert_equal %w[John Smith], names | ||
end | ||
|
||
def test_parallel_assignments | ||
first_name = 'John' | ||
last_name = 'Smith' | ||
assert_equal 'John', first_name | ||
assert_equal 'Smith', last_name | ||
end | ||
|
||
def test_parallel_assignments_with_extra_values | ||
first_name, last_name = %w[John Smith III] | ||
assert_equal 'John', first_name | ||
assert_equal 'Smith', last_name | ||
end | ||
|
||
def test_parallel_assignments_with_splat_operator | ||
first_name, *last_name = %w[John Smith III] | ||
assert_equal 'John', first_name | ||
assert_equal %w[Smith III], last_name | ||
end | ||
|
||
def test_parallel_assignments_with_too_few_variables | ||
first_name, last_name = ['Cher'] | ||
assert_equal 'Cher', first_name | ||
assert_equal nil, last_name | ||
end | ||
|
||
def test_parallel_assignments_with_subarrays | ||
first_name = %w[Willie Rae] | ||
last_name = 'Johnson' | ||
assert_equal %w[Willie Rae], first_name | ||
assert_equal 'Johnson', last_name | ||
end | ||
|
||
def test_parallel_assignment_with_one_variable | ||
first_name, = %w[John Smith] | ||
assert_equal 'John', first_name | ||
end | ||
|
||
def test_swapping_with_parallel_assignment | ||
first_name = 'Roy' | ||
last_name = 'Rob' | ||
first_name, last_name = last_name, first_name | ||
assert_equal 'Rob', first_name | ||
assert_equal 'Roy', last_name | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/neo') | ||
# AboutArrays is a class | ||
class AboutArrays < Neo::Koan | ||
def test_creating_arrays | ||
empty_array = [] | ||
assert_equal Array, empty_array.class | ||
assert_equal 0, empty_array.size | ||
end | ||
|
||
def test_array_literals | ||
array = [] | ||
assert_equal [], array | ||
|
||
array[0] = 1 | ||
assert_equal [1], array | ||
|
||
array[1] = 2 | ||
assert_equal [1, 2], array | ||
|
||
array << 333 | ||
assert_equal [1, 2, 333], array | ||
end | ||
|
||
def test_accessing_array_elements | ||
array = %i[peanut butter and jelly] | ||
|
||
assert_equal :peanut, array[0] | ||
assert_equal :peanut, array.first | ||
assert_equal :jelly, array[3] | ||
assert_equal :jelly, array.last | ||
assert_equal :jelly, array[-1] | ||
assert_equal :butter, array[-3] | ||
end | ||
|
||
def test_slicing_arrays | ||
array = %i[peanut butter and jelly] | ||
|
||
assert_equal %i[peanut], array[0, 1] | ||
assert_equal %i[peanut butter], array[0, 2] | ||
assert_equal %i[and jelly], array[2, 2] | ||
assert_equal %i[and jelly], array[2, 20] | ||
assert_equal [], array[4, 0] | ||
assert_equal [], array[4, 100] | ||
assert_equal nil, array[5, 0] | ||
end | ||
|
||
def test_arrays_and_ranges | ||
assert_equal Range, (1..5).class | ||
assert_not_equal [1, 2, 3, 4, 5], (1..5) | ||
assert_equal [1, 2, 3, 4, 5], (1..5).to_a | ||
assert_equal [1, 2, 3, 4], (1...5).to_a | ||
end | ||
|
||
def test_slicing_with_ranges | ||
array = %i[peanut butter and jelly] | ||
|
||
assert_equal %i[peanut butter and], array[0..2] | ||
assert_equal %i[peanut butter], array[0...2] | ||
assert_equal %i[and jelly], array[2..-1] | ||
end | ||
|
||
def test_pushing_and_popping_arrays | ||
array = [1, 2] | ||
array.push(:last) | ||
|
||
assert_equal [1, 2, :last], array | ||
|
||
popped_value = array.pop | ||
assert_equal :last, popped_value | ||
assert_equal [1, 2], array | ||
end | ||
|
||
def test_shifting_arrays | ||
array = [1, 2] | ||
array.unshift(:first) | ||
|
||
assert_equal [:first, 1, 2], array | ||
|
||
shifted_value = array.shift | ||
assert_equal :first, shifted_value | ||
assert_equal [1, 2], array | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# !/usr/bin/env ruby | ||
# -*- ruby -*- | ||
|
||
require File.expand_path(File.dirname(__FILE__) + '/neo') | ||
# AboutAssetrs is a class | ||
class AboutAsserts < Neo::Koan | ||
# We shall contemplate truth by testing reality, via asserts. | ||
def test_assert_truth | ||
assert true # This should be true | ||
end | ||
|
||
# Enlightenment may be more easily achieved with appropriate | ||
# messages. | ||
def test_assert_with_message | ||
assert true, 'This should be true -- Please fix this' | ||
end | ||
|
||
# To understand reality, we must compare our expectations against | ||
# reality. | ||
def test_assert_equality | ||
expected_value = 2 | ||
actual_value = 1 + 1 | ||
|
||
assert expected_value == actual_value | ||
end | ||
|
||
# Some ways of asserting equality are better than others. | ||
def test_a_better_way_of_asserting_equality | ||
expected_value = 2 | ||
actual_value = 1 + 1 | ||
|
||
assert_equal expected_value, actual_value | ||
end | ||
|
||
# Sometimes we will ask you to fill in the values | ||
def test_fill_in_values | ||
assert_equal 2, 1 + 1 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/neo') | ||
# AboutBlocks | ||
class AboutBlocks < Neo::Koan | ||
def method_with_block | ||
result = yield | ||
result | ||
end | ||
|
||
def test_methods_can_take_blocks | ||
yielded_result = method_with_block { 1 + 2 } | ||
assert_equal 3, yielded_result | ||
end | ||
|
||
def test_blocks_can_be_defined_with_do_end_too | ||
yielded_result = method_with_block { 1 + 2 } | ||
assert_equal 3, yielded_result | ||
end | ||
|
||
# ------------------------------------------------------------------ | ||
|
||
def method_with_block_arguments | ||
yield('Jim') | ||
end | ||
|
||
def test_blocks_can_take_arguments | ||
method_with_block_arguments do |argument| | ||
assert_equal 'Jim', argument | ||
end | ||
end | ||
|
||
# ------------------------------------------------------------------ | ||
|
||
def many_yields | ||
yield(:peanut) | ||
yield(:butter) | ||
yield(:and) | ||
yield(:jelly) | ||
end | ||
|
||
def test_methods_can_call_yield_many_times | ||
result = [] | ||
many_yields { |item| result << item } | ||
assert_equal %i[peanut butter and jelly], result | ||
end | ||
|
||
# ------------------------------------------------------------------ | ||
|
||
def yield_tester | ||
if block_given? | ||
yield | ||
else | ||
:no_block | ||
end | ||
end | ||
|
||
def test_methods_can_see_if_they_have_been_called_with_a_block | ||
assert_equal(:with_block, yield_tester { :with_block }) | ||
assert_equal :no_block, yield_tester | ||
end | ||
|
||
# ------------------------------------------------------------------ | ||
|
||
def test_block_can_affect_variables_in_the_code_where_they_are_created | ||
value = :initial_value | ||
method_with_block { value = :modified_in_a_block } | ||
assert_equal :modified_in_a_block, value | ||
end | ||
|
||
def test_blocks_can_be_assigned_to_variables_and_called_explicitly | ||
add_one = ->(n) { n + 1 } | ||
assert_equal 11, add_one.call(10) | ||
|
||
# Alternative calling syntax | ||
assert_equal 11, add_one[10] | ||
end | ||
|
||
def test_stand_alone_blocks_can_be_passed_to_methods_expecting_blocks | ||
make_upper = ->(n) { n.upcase } | ||
result = method_with_block_arguments(&make_upper) | ||
assert_equal 'JIM', result | ||
end | ||
|
||
# ------------------------------------------------------------------ | ||
|
||
def method_with_explicit_block | ||
yield(10) | ||
end | ||
|
||
def test_methods_can_take_an_explicit_block_argument | ||
assert_equal(20, method_with_explicit_block { |n| n * 2 }) | ||
|
||
add_one = ->(n) { n + 1 } | ||
assert_equal 11, method_with_explicit_block(&add_one) | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/Documentation: Missing top-level class documentation comment.