Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

2370-1 #134

Open
wants to merge 73 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
63c756d
2294-0
DenisVolchek Jul 5, 2018
7f8309a
Add video and 1.rb for task 0.
LikaLex Jul 5, 2018
23b7ef5
codestyle
DenisVolchek Jul 5, 2018
0e34e2f
Remove video.
LikaLex Jul 5, 2018
a27bb6f
trailing blank line
DenisVolchek Jul 5, 2018
e1e54c3
changed directories
DenisVolchek Jul 5, 2018
c8c6cf1
Move file to the task specific folder.
LikaLex Jul 5, 2018
e875a92
Merge pull request #5 from LikaLex/2199/0
Jul 5, 2018
dad8934
Merge pull request #7 from DenisVolchek/2294-0
Jul 5, 2018
def5f9b
Implement hw-0
SashaShostyr Jul 5, 2018
b0f1297
Merge pull request #8 from SashaShostyr/hw-0
Jul 5, 2018
81bb64d
2227-0
VladislavIlyuschits Jul 5, 2018
9f4fd4d
2211-0
TanyaAkulich Jul 5, 2018
d56f355
refactored folder structure
VladislavIlyuschits Jul 5, 2018
01b6664
added task 0 for 2263
ARtoriouSs Jul 5, 2018
c56de35
add 1.rb
Jul 5, 2018
67c360e
change branch
Jul 5, 2018
c58902a
added final newline to 1.rb
ARtoriouSs Jul 6, 2018
319a79e
Add the first task
andreydro Jul 6, 2018
92f704e
2223-0
VDmitryO Jul 6, 2018
659909b
Create 1.rb
misterOlrox Jul 6, 2018
33d9e33
created 1.rb
idealasgas Jul 6, 2018
16a0b07
Create personal folder
krlklim Jul 6, 2018
c28bc65
Merge pull request #9 from VladislavIlyuschits/2227-0
Jul 6, 2018
ad8ba40
Merge pull request #10 from TanyaAkulich/0
Jul 6, 2018
95787ab
completed homework 0
JacksonBaltramovich Jul 6, 2018
b310d6f
2256 - 0
v-kazantsev Jul 6, 2018
aa01806
Complete task
Jul 6, 2018
8617430
Merge pull request #24 from idealasgas/zerotask
Jul 6, 2018
5db2006
Create a .rb file with text
v-kazantsev Jul 6, 2018
51ad0d1
Merge pull request #29 from Phin89/2241/0
Jul 6, 2018
0fd4534
Merge pull request #28 from v-kazantsev/0
Jul 6, 2018
25cbc88
Merge pull request #27 from JacksonBaltramovich/2213-0
Jul 6, 2018
93e2c6b
Merge pull request #20 from krlklim/2249/0
Jul 6, 2018
f7a0958
Merge pull request #11 from ARtoriouSs/0
Jul 6, 2018
46391ba
Merge pull request #19 from misterOlrox/misterOlrox-patch-1
Jul 6, 2018
9311097
Merge pull request #15 from ZhenyaZhak/2232-0
Jul 6, 2018
da6219e
implement hw-0
Jul 6, 2018
8b50b6f
Merge pull request #18 from andreydro/2226/0
Jul 6, 2018
e4cca52
Initial commit
Aleksei12942 Jul 6, 2018
7b61f82
Create 1.rb
lstpsche Jul 6, 2018
7445eee
Create 1.rb
shamritskiy3468 Jul 6, 2018
73aef52
Update 1.rb
lstpsche Jul 6, 2018
1c01273
create 1.rb
brutu33 Jul 6, 2018
2125c03
Create 1.rb
Jul 6, 2018
adf10d7
Add file 1.rb
Jul 6, 2018
867baef
Remove unnecessary files
Jul 6, 2018
37b5502
Merge pull request #33 from DSummerduck/master
Jul 6, 2018
42de175
Merge pull request #34 from shamritskiy3468/2197/0
Jul 6, 2018
dc017bb
implement hw0
Jul 6, 2018
c64c1e0
Merge pull request #25 from nikitasakov/2214-0
Jul 6, 2018
007fe2c
Merge pull request #32 from lstpsche/master
Jul 6, 2018
4b52559
Merge pull request #31 from ilya-github/master
Jul 6, 2018
ceb1a87
Merge pull request #21 from VDmitryO/2223-0
Jul 6, 2018
1ef8dc0
Merge pull request #36 from Vadser/homework-0
Jul 6, 2018
8c6671a
Merge pull request #35 from brutu33/master
Jul 6, 2018
4b86da0
task 0
reedzyy Jul 6, 2018
bca5771
Merge pull request #39 from leshkacore/2333
Jul 6, 2018
bbbace6
Add final newline
Aleksei12942 Jul 6, 2018
ed96605
Merge pull request #26 from Aleksei12942/first_task
Jul 6, 2018
ab62b2c
Create 1.rb
AntonNaumchik Jul 6, 2018
692040f
Create about_array_assignment.rb
AntonNaumchik Jul 8, 2018
7bbf7a9
Fixed files
AntonNaumchik Jul 10, 2018
540f057
Fix corrupted files
AntonNaumchik Jul 10, 2018
a6beeeb
Delete .reek
AntonNaumchik Jul 10, 2018
843d47b
Delete .todo.reek
AntonNaumchik Jul 10, 2018
d409d7b
Fix rubocop issues
AntonNaumchik Jul 10, 2018
6308e2f
Merge branch 'master' of https://github.com/AntonNaumchik/summer-2018
AntonNaumchik Jul 10, 2018
62a1736
Add top-level comment to about_array_assignment.rb
AntonNaumchik Jul 10, 2018
f0025d0
Fix about_asserts.rb rubocop issues
AntonNaumchik Jul 10, 2018
b3c27cb
fix about_message_passinf.rb
AntonNaumchik Jul 10, 2018
6b26409
fix about_message_passing.rb
AntonNaumchik Jul 10, 2018
fd61152
Merge branch 'master' of github.com:rubizza-survival-camp/summer-2018
AntonNaumchik Jul 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 2197/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2199/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2209/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2211/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2213/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2214/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2223/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2226/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2227/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2232/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon '
1 change: 1 addition & 0 deletions 2241/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2249/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2256/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2263/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2294/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2312/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2331/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2333/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2346/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2355/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2364/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
1 change: 1 addition & 0 deletions 2370/0/1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'Chunky bacon'
54 changes: 54 additions & 0 deletions 2370/1/about_array_assignment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
require File.expand_path(File.dirname(__FILE__) + '/neo')

# Comment
class AboutArrayAssignment < Neo::Koan

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.

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
83 changes: 83 additions & 0 deletions 2370/1/about_arrays.rb
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
36 changes: 36 additions & 0 deletions 2370/1/about_asserts.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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
95 changes: 95 additions & 0 deletions 2370/1/about_blocks.rb
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
Loading