{"action":"created","comment":{"url":"https://api.github.com/repos/evg-tray/tn/pulls/comments/88803475","pull_request_review_id":9365534,"id":88803475,"diff_hunk":"@@ -285,6 +311,94 @@ def menu_trains_by_station\n   end\n end\n \n+def print_list_wagons_by_train\n+  loop do\n+    puts \"===\".blue\n+    puts \"Вы находитесь в меню вывода списка вагонов поезда.\".green\n+    puts \"Для какой какого поезда вывести список вагонов?\".green\n+    puts \"Введите номер поезда:\".green\n+    puts \"Для перехода в меню выше введите #{INPUT_EXIT}\".red\n+    number = gets.chomp\n+    break if number == INPUT_EXIT\n+    train = @trains[number]\n+    if train == 0\n+      puts \"Поезда с номером #{number} не существует\".red\n+    else\n+      puts \"Вагоны у поезда номер #{number}:\".green\n+      train.each_wagon do |wagon|\n+        if train.class == CargoTrain\n+          message = \"#{wagon.number}, грузовой, свободное место: \"\n+          message += \"#{wagon.free_volume}, занятое место: #{wagon.busy_volume}\"\n+          puts message\n+        else\n+          message = \"#{wagon.number}, пассажирский, свободные места: \"\n+          message += \"#{wagon.free_seats}, занятые места: #{wagon.busy_seats}\"\n+          puts message\n+        end\n+      end\n+    end\n+  end\n+end\n+\n+def print_list_trains_format\n+  loop do\n+    puts \"===\".blue\n+    puts \"Вы находитесь в меню вывода списка поездов на станции.\".green\n+    puts \"Для какой станции вывести список поездов? Введите название станции:\".green\n+    puts \"Для перехода в меню выше введите #{INPUT_EXIT}\".red\n+    name_station = gets.chomp\n+    break if name_station == INPUT_EXIT\n+    station = @stations[name_station]\n+    if station == 0\n+      puts \"Введенной станции не существует\".red\n+    else\n+      puts \"Поезда на станции #{name_station} в формате:\".green\n+      station.each_train do |train|\n+        puts \"#{train.number}, тип: #{train.class.type}, вагонов: #{train.wagons.count}\"\n+      end\n+    end\n+  end\n+end\n+\n+def take_seat_cargo\n+  loop do\n+    puts \"Введите номер вагона:\".green\n+    puts \"Для перехода в главное меню введите #{INPUT_EXIT}\".red\n+    number = gets.chomp\n+    break if number == INPUT_EXIT\n+    wagon = @wagons[number]\n+    if wagon == 0\n+      puts \"Введенного вагона не существует\".red\n+    else\n+      if wagon.class == CargoWagon","path":"oop/main.rb","position":193,"original_position":193,"commit_id":"8c0e2d952c1daebb12cdeee2793ca48edd173304","original_commit_id":"8c0e2d952c1daebb12cdeee2793ca48edd173304","user":{"login":"psylone","id":224141,"avatar_url":"https://avatars.githubusercontent.com/u/224141?v=3","gravatar_id":"","url":"https://api.github.com/users/psylone","html_url":"https://github.com/psylone","followers_url":"https://api.github.com/users/psylone/followers","following_url":"https://api.github.com/users/psylone/following{/other_user}","gists_url":"https://api.github.com/users/psylone/gists{/gist_id}","starred_url":"https://api.github.com/users/psylone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psylone/subscriptions","organizations_url":"https://api.github.com/users/psylone/orgs","repos_url":"https://api.github.com/users/psylone/repos","events_url":"https://api.github.com/users/psylone/events{/privacy}","received_events_url":"https://api.github.com/users/psylone/received_events","type":"User","site_admin":false},"body":"Через `case-when-end` такое делать удобней, поскольку `case` проверяет совпадение с помощью метода `===` который иногда определяется как метод _включения_. Иными словами, можно так:\r\n\r\n```ruby\r\ncase wagon\r\n  when CargoWagon\r\n    take_cargo(wagon)\r\n  else\r\n    take_passengers(wagon)\r\nend\r\n```","created_at":"2016-11-20T15:08:21Z","updated_at":"2016-11-20T15:08:30Z","html_url":"https://github.com/evg-tray/tn/pull/4#discussion_r88803475","pull_request_url":"https://api.github.com/repos/evg-tray/tn/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/evg-tray/tn/pulls/comments/88803475"},"html":{"href":"https://github.com/evg-tray/tn/pull/4#discussion_r88803475"},"pull_request":{"href":"https://api.github.com/repos/evg-tray/tn/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/evg-tray/tn/pulls/4","id":94486765,"html_url":"https://github.com/evg-tray/tn/pull/4","diff_url":"https://github.com/evg-tray/tn/pull/4.diff","patch_url":"https://github.com/evg-tray/tn/pull/4.patch","issue_url":"https://api.github.com/repos/evg-tray/tn/issues/4","number":4,"state":"open","locked":false,"title":"Lesson 7","user":{"login":"evg-tray","id":23312747,"avatar_url":"https://avatars.githubusercontent.com/u/23312747?v=3","gravatar_id":"","url":"https://api.github.com/users/evg-tray","html_url":"https://github.com/evg-tray","followers_url":"https://api.github.com/users/evg-tray/followers","following_url":"https://api.github.com/users/evg-tray/following{/other_user}","gists_url":"https://api.github.com/users/evg-tray/gists{/gist_id}","starred_url":"https://api.github.com/users/evg-tray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evg-tray/subscriptions","organizations_url":"https://api.github.com/users/evg-tray/orgs","repos_url":"https://api.github.com/users/evg-tray/repos","events_url":"https://api.github.com/users/evg-tray/events{/privacy}","received_events_url":"https://api.github.com/users/evg-tray/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-19T16:32:31Z","updated_at":"2016-11-20T15:08:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"97c43f1d98d9dfa2ae4a658be438225dcaced103","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/evg-tray/tn/pulls/4/commits","review_comments_url":"https://api.github.com/repos/evg-tray/tn/pulls/4/comments","review_comment_url":"https://api.github.com/repos/evg-tray/tn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/evg-tray/tn/issues/4/comments","statuses_url":"https://api.github.com/repos/evg-tray/tn/statuses/8c0e2d952c1daebb12cdeee2793ca48edd173304","head":{"label":"evg-tray:blocks","ref":"blocks","sha":"8c0e2d952c1daebb12cdeee2793ca48edd173304","user":{"login":"evg-tray","id":23312747,"avatar_url":"https://avatars.githubusercontent.com/u/23312747?v=3","gravatar_id":"","url":"https://api.github.com/users/evg-tray","html_url":"https://github.com/evg-tray","followers_url":"https://api.github.com/users/evg-tray/followers","following_url":"https://api.github.com/users/evg-tray/following{/other_user}","gists_url":"https://api.github.com/users/evg-tray/gists{/gist_id}","starred_url":"https://api.github.com/users/evg-tray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evg-tray/subscriptions","organizations_url":"https://api.github.com/users/evg-tray/orgs","repos_url":"https://api.github.com/users/evg-tray/repos","events_url":"https://api.github.com/users/evg-tray/events{/privacy}","received_events_url":"https://api.github.com/users/evg-tray/received_events","type":"User","site_admin":false},"repo":{"id":73086555,"name":"tn","full_name":"evg-tray/tn","owner":{"login":"evg-tray","id":23312747,"avatar_url":"https://avatars.githubusercontent.com/u/23312747?v=3","gravatar_id":"","url":"https://api.github.com/users/evg-tray","html_url":"https://github.com/evg-tray","followers_url":"https://api.github.com/users/evg-tray/followers","following_url":"https://api.github.com/users/evg-tray/following{/other_user}","gists_url":"https://api.github.com/users/evg-tray/gists{/gist_id}","starred_url":"https://api.github.com/users/evg-tray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evg-tray/subscriptions","organizations_url":"https://api.github.com/users/evg-tray/orgs","repos_url":"https://api.github.com/users/evg-tray/repos","events_url":"https://api.github.com/users/evg-tray/events{/privacy}","received_events_url":"https://api.github.com/users/evg-tray/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/evg-tray/tn","description":null,"fork":false,"url":"https://api.github.com/repos/evg-tray/tn","forks_url":"https://api.github.com/repos/evg-tray/tn/forks","keys_url":"https://api.github.com/repos/evg-tray/tn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/evg-tray/tn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/evg-tray/tn/teams","hooks_url":"https://api.github.com/repos/evg-tray/tn/hooks","issue_events_url":"https://api.github.com/repos/evg-tray/tn/issues/events{/number}","events_url":"https://api.github.com/repos/evg-tray/tn/events","assignees_url":"https://api.github.com/repos/evg-tray/tn/assignees{/user}","branches_url":"https://api.github.com/repos/evg-tray/tn/branches{/branch}","tags_url":"https://api.github.com/repos/evg-tray/tn/tags","blobs_url":"https://api.github.com/repos/evg-tray/tn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/evg-tray/tn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/evg-tray/tn/git/refs{/sha}","trees_url":"https://api.github.com/repos/evg-tray/tn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/evg-tray/tn/statuses/{sha}","languages_url":"https://api.github.com/repos/evg-tray/tn/languages","stargazers_url":"https://api.github.com/repos/evg-tray/tn/stargazers","contributors_url":"https://api.github.com/repos/evg-tray/tn/contributors","subscribers_url":"https://api.github.com/repos/evg-tray/tn/subscribers","subscription_url":"https://api.github.com/repos/evg-tray/tn/subscription","commits_url":"https://api.github.com/repos/evg-tray/tn/commits{/sha}","git_commits_url":"https://api.github.com/repos/evg-tray/tn/git/commits{/sha}","comments_url":"https://api.github.com/repos/evg-tray/tn/comments{/number}","issue_comment_url":"https://api.github.com/repos/evg-tray/tn/issues/comments{/number}","contents_url":"https://api.github.com/repos/evg-tray/tn/contents/{+path}","compare_url":"https://api.github.com/repos/evg-tray/tn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/evg-tray/tn/merges","archive_url":"https://api.github.com/repos/evg-tray/tn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/evg-tray/tn/downloads","issues_url":"https://api.github.com/repos/evg-tray/tn/issues{/number}","pulls_url":"https://api.github.com/repos/evg-tray/tn/pulls{/number}","milestones_url":"https://api.github.com/repos/evg-tray/tn/milestones{/number}","notifications_url":"https://api.github.com/repos/evg-tray/tn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/evg-tray/tn/labels{/name}","releases_url":"https://api.github.com/repos/evg-tray/tn/releases{/id}","deployments_url":"https://api.github.com/repos/evg-tray/tn/deployments","created_at":"2016-11-07T14:31:04Z","updated_at":"2016-11-07T20:40:03Z","pushed_at":"2016-11-19T16:32:31Z","git_url":"git://github.com/evg-tray/tn.git","ssh_url":"git@github.com:evg-tray/tn.git","clone_url":"https://github.com/evg-tray/tn.git","svn_url":"https://github.com/evg-tray/tn","homepage":null,"size":28,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"evg-tray:master","ref":"master","sha":"6ea45df305f7f2ee7cee166926f7ceb1e00be079","user":{"login":"evg-tray","id":23312747,"avatar_url":"https://avatars.githubusercontent.com/u/23312747?v=3","gravatar_id":"","url":"https://api.github.com/users/evg-tray","html_url":"https://github.com/evg-tray","followers_url":"https://api.github.com/users/evg-tray/followers","following_url":"https://api.github.com/users/evg-tray/following{/other_user}","gists_url":"https://api.github.com/users/evg-tray/gists{/gist_id}","starred_url":"https://api.github.com/users/evg-tray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evg-tray/subscriptions","organizations_url":"https://api.github.com/users/evg-tray/orgs","repos_url":"https://api.github.com/users/evg-tray/repos","events_url":"https://api.github.com/users/evg-tray/events{/privacy}","received_events_url":"https://api.github.com/users/evg-tray/received_events","type":"User","site_admin":false},"repo":{"id":73086555,"name":"tn","full_name":"evg-tray/tn","owner":{"login":"evg-tray","id":23312747,"avatar_url":"https://avatars.githubusercontent.com/u/23312747?v=3","gravatar_id":"","url":"https://api.github.com/users/evg-tray","html_url":"https://github.com/evg-tray","followers_url":"https://api.github.com/users/evg-tray/followers","following_url":"https://api.github.com/users/evg-tray/following{/other_user}","gists_url":"https://api.github.com/users/evg-tray/gists{/gist_id}","starred_url":"https://api.github.com/users/evg-tray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evg-tray/subscriptions","organizations_url":"https://api.github.com/users/evg-tray/orgs","repos_url":"https://api.github.com/users/evg-tray/repos","events_url":"https://api.github.com/users/evg-tray/events{/privacy}","received_events_url":"https://api.github.com/users/evg-tray/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/evg-tray/tn","description":null,"fork":false,"url":"https://api.github.com/repos/evg-tray/tn","forks_url":"https://api.github.com/repos/evg-tray/tn/forks","keys_url":"https://api.github.com/repos/evg-tray/tn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/evg-tray/tn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/evg-tray/tn/teams","hooks_url":"https://api.github.com/repos/evg-tray/tn/hooks","issue_events_url":"https://api.github.com/repos/evg-tray/tn/issues/events{/number}","events_url":"https://api.github.com/repos/evg-tray/tn/events","assignees_url":"https://api.github.com/repos/evg-tray/tn/assignees{/user}","branches_url":"https://api.github.com/repos/evg-tray/tn/branches{/branch}","tags_url":"https://api.github.com/repos/evg-tray/tn/tags","blobs_url":"https://api.github.com/repos/evg-tray/tn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/evg-tray/tn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/evg-tray/tn/git/refs{/sha}","trees_url":"https://api.github.com/repos/evg-tray/tn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/evg-tray/tn/statuses/{sha}","languages_url":"https://api.github.com/repos/evg-tray/tn/languages","stargazers_url":"https://api.github.com/repos/evg-tray/tn/stargazers","contributors_url":"https://api.github.com/repos/evg-tray/tn/contributors","subscribers_url":"https://api.github.com/repos/evg-tray/tn/subscribers","subscription_url":"https://api.github.com/repos/evg-tray/tn/subscription","commits_url":"https://api.github.com/repos/evg-tray/tn/commits{/sha}","git_commits_url":"https://api.github.com/repos/evg-tray/tn/git/commits{/sha}","comments_url":"https://api.github.com/repos/evg-tray/tn/comments{/number}","issue_comment_url":"https://api.github.com/repos/evg-tray/tn/issues/comments{/number}","contents_url":"https://api.github.com/repos/evg-tray/tn/contents/{+path}","compare_url":"https://api.github.com/repos/evg-tray/tn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/evg-tray/tn/merges","archive_url":"https://api.github.com/repos/evg-tray/tn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/evg-tray/tn/downloads","issues_url":"https://api.github.com/repos/evg-tray/tn/issues{/number}","pulls_url":"https://api.github.com/repos/evg-tray/tn/pulls{/number}","milestones_url":"https://api.github.com/repos/evg-tray/tn/milestones{/number}","notifications_url":"https://api.github.com/repos/evg-tray/tn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/evg-tray/tn/labels{/name}","releases_url":"https://api.github.com/repos/evg-tray/tn/releases{/id}","deployments_url":"https://api.github.com/repos/evg-tray/tn/deployments","created_at":"2016-11-07T14:31:04Z","updated_at":"2016-11-07T20:40:03Z","pushed_at":"2016-11-19T16:32:31Z","git_url":"git://github.com/evg-tray/tn.git","ssh_url":"git@github.com:evg-tray/tn.git","clone_url":"https://github.com/evg-tray/tn.git","svn_url":"https://github.com/evg-tray/tn","homepage":null,"size":28,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/evg-tray/tn/pulls/4"},"html":{"href":"https://github.com/evg-tray/tn/pull/4"},"issue":{"href":"https://api.github.com/repos/evg-tray/tn/issues/4"},"comments":{"href":"https://api.github.com/repos/evg-tray/tn/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/evg-tray/tn/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/evg-tray/tn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/evg-tray/tn/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/evg-tray/tn/statuses/8c0e2d952c1daebb12cdeee2793ca48edd173304"}}}}
{"actor":{"display_login":"psylone"}}