{"action":"created","comment":{"url":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls/comments/41701396","id":41701396,"diff_hunk":"@@ -0,0 +1,130 @@\n+#!/usr/bin/env ruby\n+\n+# У класса Note есть метод share, который меняет атрибут shared объекта\n+# этого класса с false на true\n+#\n+# У класса Note есть атрибуты shared и text\n+class Note\n+  attr_reader :shared, :text\n+\n+  def initialize(text = nil, shared = false)\n+    @text = text\n+    @shared = shared\n+  end\n+\n+  def share\n+    @shared = true\n+  end\n+\n+  def unshare\n+    @shared = false\n+  end\n+end\n+\n+# У класса Notebook есть методы add_note, clean (удаляет все заметки)\n+# Ещё у Notebook есть атрибут с массивом заметок\n+class Notebook\n+  attr_reader :notes\n+\n+  def initialize\n+    @notes = Array.new\n+  end\n+\n+  def add_note(note)\n+    if is_note? note\n+      @notes << note\n+    end\n+  end\n+\n+  def add_notes(notes)\n+    Array(notes).each { |note| add_note note }\n+  end\n+\n+  def clean\n+    @notes = Array.new\n+  end\n+\n+  def is_note?(arg)\n+    arg.is_a?(Note)\n+  end\n+end\n+\n+\n+# Ещё есть класс SharedNotebook, подкласс класса Notebook\n+#\n+# У него переопределяется метод add_note, любая добавленная в него заметка\n+# становится shared\n+#\n+# Ещё у самого класса SharedNotebook есть метод count, который возвращает\n+# количество созданных SharedNotebook\n+class SharedNotebook < Notebook\n+  @@counter = 0\n+\n+  def initialize\n+    super\n+    @@counter += 1\n+  end\n+\n+  def add_note(note)\n+    if is_note? note\n+      @notes << note.clone\n+      @notes.last.share\n+    end\n+  end\n+\n+  def self.counter\n+    @@counter\n+  end\n+end\n+\n+# Нужно реализовать указанную выше структуру классов и затем, используя её,\n+# сделать следующее:\n+#\n+# + Создать блокнот (Notebook), создать 3 заметки, добавить их в блокнот.\n+# + Создать общий блокнот, добавить предыдущие заметки в общий блокнот.\n+# + Убедиться что заметки из первого блокнота по-прежнему не расшаренные.\n+# + Вывести количество общих блокнотов.\n+#\n+# - Предоставить итоговый код в виде github gist’а и скриншотов выполнения\n+# программы.\n+class Helper\n+  def self.print_notes(notes)\n+    Array(notes).each do |note|\n+      print(\"Text: #{note.text}\\nShared: #{note.shared}\\n\\n\")\n+    end\n+  end\n+end\n+\n+\n+puts \"---\"\n+puts \"Creation notes...\"\n+notes = [Note.new(\"First note\"),\n+  Note.new(\"Second note\"),","path":"oop_practice.rb","position":102,"original_position":102,"commit_id":"8ff00ff361c94acf1e9441de6238c6f2407ad0c2","original_commit_id":"8ff00ff361c94acf1e9441de6238c6f2407ad0c2","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Align the elements of an array literal if they span more than one line.","created_at":"2015-10-10T20:51:37Z","updated_at":"2015-10-10T20:51:37Z","html_url":"https://github.com/ksbobrov/ruby-basics/pull/1#discussion_r41701396","pull_request_url":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls/comments/41701396"},"html":{"href":"https://github.com/ksbobrov/ruby-basics/pull/1#discussion_r41701396"},"pull_request":{"href":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls/1","id":46407005,"html_url":"https://github.com/ksbobrov/ruby-basics/pull/1","diff_url":"https://github.com/ksbobrov/ruby-basics/pull/1.diff","patch_url":"https://github.com/ksbobrov/ruby-basics/pull/1.patch","issue_url":"https://api.github.com/repos/ksbobrov/ruby-basics/issues/1","number":1,"state":"open","locked":false,"title":"Create stub","user":{"login":"ksbobrov","id":8874753,"avatar_url":"https://avatars.githubusercontent.com/u/8874753?v=3","gravatar_id":"","url":"https://api.github.com/users/ksbobrov","html_url":"https://github.com/ksbobrov","followers_url":"https://api.github.com/users/ksbobrov/followers","following_url":"https://api.github.com/users/ksbobrov/following{/other_user}","gists_url":"https://api.github.com/users/ksbobrov/gists{/gist_id}","starred_url":"https://api.github.com/users/ksbobrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksbobrov/subscriptions","organizations_url":"https://api.github.com/users/ksbobrov/orgs","repos_url":"https://api.github.com/users/ksbobrov/repos","events_url":"https://api.github.com/users/ksbobrov/events{/privacy}","received_events_url":"https://api.github.com/users/ksbobrov/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-30T14:15:18Z","updated_at":"2015-10-10T20:51:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d01bc18e9b3623abc3c42e9013bd1101766e98c6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls/1/commits","review_comments_url":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls/1/comments","review_comment_url":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ksbobrov/ruby-basics/issues/1/comments","statuses_url":"https://api.github.com/repos/ksbobrov/ruby-basics/statuses/8ff00ff361c94acf1e9441de6238c6f2407ad0c2","head":{"label":"ksbobrov:first-task","ref":"first-task","sha":"8ff00ff361c94acf1e9441de6238c6f2407ad0c2","user":{"login":"ksbobrov","id":8874753,"avatar_url":"https://avatars.githubusercontent.com/u/8874753?v=3","gravatar_id":"","url":"https://api.github.com/users/ksbobrov","html_url":"https://github.com/ksbobrov","followers_url":"https://api.github.com/users/ksbobrov/followers","following_url":"https://api.github.com/users/ksbobrov/following{/other_user}","gists_url":"https://api.github.com/users/ksbobrov/gists{/gist_id}","starred_url":"https://api.github.com/users/ksbobrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksbobrov/subscriptions","organizations_url":"https://api.github.com/users/ksbobrov/orgs","repos_url":"https://api.github.com/users/ksbobrov/repos","events_url":"https://api.github.com/users/ksbobrov/events{/privacy}","received_events_url":"https://api.github.com/users/ksbobrov/received_events","type":"User","site_admin":false},"repo":{"id":43436720,"name":"ruby-basics","full_name":"ksbobrov/ruby-basics","owner":{"login":"ksbobrov","id":8874753,"avatar_url":"https://avatars.githubusercontent.com/u/8874753?v=3","gravatar_id":"","url":"https://api.github.com/users/ksbobrov","html_url":"https://github.com/ksbobrov","followers_url":"https://api.github.com/users/ksbobrov/followers","following_url":"https://api.github.com/users/ksbobrov/following{/other_user}","gists_url":"https://api.github.com/users/ksbobrov/gists{/gist_id}","starred_url":"https://api.github.com/users/ksbobrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksbobrov/subscriptions","organizations_url":"https://api.github.com/users/ksbobrov/orgs","repos_url":"https://api.github.com/users/ksbobrov/repos","events_url":"https://api.github.com/users/ksbobrov/events{/privacy}","received_events_url":"https://api.github.com/users/ksbobrov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ksbobrov/ruby-basics","description":"","fork":false,"url":"https://api.github.com/repos/ksbobrov/ruby-basics","forks_url":"https://api.github.com/repos/ksbobrov/ruby-basics/forks","keys_url":"https://api.github.com/repos/ksbobrov/ruby-basics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ksbobrov/ruby-basics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ksbobrov/ruby-basics/teams","hooks_url":"https://api.github.com/repos/ksbobrov/ruby-basics/hooks","issue_events_url":"https://api.github.com/repos/ksbobrov/ruby-basics/issues/events{/number}","events_url":"https://api.github.com/repos/ksbobrov/ruby-basics/events","assignees_url":"https://api.github.com/repos/ksbobrov/ruby-basics/assignees{/user}","branches_url":"https://api.github.com/repos/ksbobrov/ruby-basics/branches{/branch}","tags_url":"https://api.github.com/repos/ksbobrov/ruby-basics/tags","blobs_url":"https://api.github.com/repos/ksbobrov/ruby-basics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ksbobrov/ruby-basics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ksbobrov/ruby-basics/git/refs{/sha}","trees_url":"https://api.github.com/repos/ksbobrov/ruby-basics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ksbobrov/ruby-basics/statuses/{sha}","languages_url":"https://api.github.com/repos/ksbobrov/ruby-basics/languages","stargazers_url":"https://api.github.com/repos/ksbobrov/ruby-basics/stargazers","contributors_url":"https://api.github.com/repos/ksbobrov/ruby-basics/contributors","subscribers_url":"https://api.github.com/repos/ksbobrov/ruby-basics/subscribers","subscription_url":"https://api.github.com/repos/ksbobrov/ruby-basics/subscription","commits_url":"https://api.github.com/repos/ksbobrov/ruby-basics/commits{/sha}","git_commits_url":"https://api.github.com/repos/ksbobrov/ruby-basics/git/commits{/sha}","comments_url":"https://api.github.com/repos/ksbobrov/ruby-basics/comments{/number}","issue_comment_url":"https://api.github.com/repos/ksbobrov/ruby-basics/issues/comments{/number}","contents_url":"https://api.github.com/repos/ksbobrov/ruby-basics/contents/{+path}","compare_url":"https://api.github.com/repos/ksbobrov/ruby-basics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ksbobrov/ruby-basics/merges","archive_url":"https://api.github.com/repos/ksbobrov/ruby-basics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ksbobrov/ruby-basics/downloads","issues_url":"https://api.github.com/repos/ksbobrov/ruby-basics/issues{/number}","pulls_url":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls{/number}","milestones_url":"https://api.github.com/repos/ksbobrov/ruby-basics/milestones{/number}","notifications_url":"https://api.github.com/repos/ksbobrov/ruby-basics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ksbobrov/ruby-basics/labels{/name}","releases_url":"https://api.github.com/repos/ksbobrov/ruby-basics/releases{/id}","created_at":"2015-09-30T14:09:01Z","updated_at":"2015-10-10T19:55:25Z","pushed_at":"2015-10-10T20:51:32Z","git_url":"git://github.com/ksbobrov/ruby-basics.git","ssh_url":"git@github.com:ksbobrov/ruby-basics.git","clone_url":"https://github.com/ksbobrov/ruby-basics.git","svn_url":"https://github.com/ksbobrov/ruby-basics","homepage":null,"size":152,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"ksbobrov:master","ref":"master","sha":"3294529d5ac0cbbfc0f376f70c97addbeadbe2d4","user":{"login":"ksbobrov","id":8874753,"avatar_url":"https://avatars.githubusercontent.com/u/8874753?v=3","gravatar_id":"","url":"https://api.github.com/users/ksbobrov","html_url":"https://github.com/ksbobrov","followers_url":"https://api.github.com/users/ksbobrov/followers","following_url":"https://api.github.com/users/ksbobrov/following{/other_user}","gists_url":"https://api.github.com/users/ksbobrov/gists{/gist_id}","starred_url":"https://api.github.com/users/ksbobrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksbobrov/subscriptions","organizations_url":"https://api.github.com/users/ksbobrov/orgs","repos_url":"https://api.github.com/users/ksbobrov/repos","events_url":"https://api.github.com/users/ksbobrov/events{/privacy}","received_events_url":"https://api.github.com/users/ksbobrov/received_events","type":"User","site_admin":false},"repo":{"id":43436720,"name":"ruby-basics","full_name":"ksbobrov/ruby-basics","owner":{"login":"ksbobrov","id":8874753,"avatar_url":"https://avatars.githubusercontent.com/u/8874753?v=3","gravatar_id":"","url":"https://api.github.com/users/ksbobrov","html_url":"https://github.com/ksbobrov","followers_url":"https://api.github.com/users/ksbobrov/followers","following_url":"https://api.github.com/users/ksbobrov/following{/other_user}","gists_url":"https://api.github.com/users/ksbobrov/gists{/gist_id}","starred_url":"https://api.github.com/users/ksbobrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksbobrov/subscriptions","organizations_url":"https://api.github.com/users/ksbobrov/orgs","repos_url":"https://api.github.com/users/ksbobrov/repos","events_url":"https://api.github.com/users/ksbobrov/events{/privacy}","received_events_url":"https://api.github.com/users/ksbobrov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ksbobrov/ruby-basics","description":"","fork":false,"url":"https://api.github.com/repos/ksbobrov/ruby-basics","forks_url":"https://api.github.com/repos/ksbobrov/ruby-basics/forks","keys_url":"https://api.github.com/repos/ksbobrov/ruby-basics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ksbobrov/ruby-basics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ksbobrov/ruby-basics/teams","hooks_url":"https://api.github.com/repos/ksbobrov/ruby-basics/hooks","issue_events_url":"https://api.github.com/repos/ksbobrov/ruby-basics/issues/events{/number}","events_url":"https://api.github.com/repos/ksbobrov/ruby-basics/events","assignees_url":"https://api.github.com/repos/ksbobrov/ruby-basics/assignees{/user}","branches_url":"https://api.github.com/repos/ksbobrov/ruby-basics/branches{/branch}","tags_url":"https://api.github.com/repos/ksbobrov/ruby-basics/tags","blobs_url":"https://api.github.com/repos/ksbobrov/ruby-basics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ksbobrov/ruby-basics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ksbobrov/ruby-basics/git/refs{/sha}","trees_url":"https://api.github.com/repos/ksbobrov/ruby-basics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ksbobrov/ruby-basics/statuses/{sha}","languages_url":"https://api.github.com/repos/ksbobrov/ruby-basics/languages","stargazers_url":"https://api.github.com/repos/ksbobrov/ruby-basics/stargazers","contributors_url":"https://api.github.com/repos/ksbobrov/ruby-basics/contributors","subscribers_url":"https://api.github.com/repos/ksbobrov/ruby-basics/subscribers","subscription_url":"https://api.github.com/repos/ksbobrov/ruby-basics/subscription","commits_url":"https://api.github.com/repos/ksbobrov/ruby-basics/commits{/sha}","git_commits_url":"https://api.github.com/repos/ksbobrov/ruby-basics/git/commits{/sha}","comments_url":"https://api.github.com/repos/ksbobrov/ruby-basics/comments{/number}","issue_comment_url":"https://api.github.com/repos/ksbobrov/ruby-basics/issues/comments{/number}","contents_url":"https://api.github.com/repos/ksbobrov/ruby-basics/contents/{+path}","compare_url":"https://api.github.com/repos/ksbobrov/ruby-basics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ksbobrov/ruby-basics/merges","archive_url":"https://api.github.com/repos/ksbobrov/ruby-basics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ksbobrov/ruby-basics/downloads","issues_url":"https://api.github.com/repos/ksbobrov/ruby-basics/issues{/number}","pulls_url":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls{/number}","milestones_url":"https://api.github.com/repos/ksbobrov/ruby-basics/milestones{/number}","notifications_url":"https://api.github.com/repos/ksbobrov/ruby-basics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ksbobrov/ruby-basics/labels{/name}","releases_url":"https://api.github.com/repos/ksbobrov/ruby-basics/releases{/id}","created_at":"2015-09-30T14:09:01Z","updated_at":"2015-10-10T19:55:25Z","pushed_at":"2015-10-10T20:51:32Z","git_url":"git://github.com/ksbobrov/ruby-basics.git","ssh_url":"git@github.com:ksbobrov/ruby-basics.git","clone_url":"https://github.com/ksbobrov/ruby-basics.git","svn_url":"https://github.com/ksbobrov/ruby-basics","homepage":null,"size":152,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls/1"},"html":{"href":"https://github.com/ksbobrov/ruby-basics/pull/1"},"issue":{"href":"https://api.github.com/repos/ksbobrov/ruby-basics/issues/1"},"comments":{"href":"https://api.github.com/repos/ksbobrov/ruby-basics/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ksbobrov/ruby-basics/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/ksbobrov/ruby-basics/statuses/8ff00ff361c94acf1e9441de6238c6f2407ad0c2"}}}}