{"action":"created","comment":{"url":"https://api.github.com/repos/esaulkov/movies/pulls/comments/122937516","pull_request_review_id":45093477,"id":122937516,"diff_hunk":"@@ -0,0 +1,72 @@\n+# coding: utf-8\n+\n+require 'date'\n+\n+class Movie\n+  PARAMS = %i[\n+    link name year country release genres length\n+    rating producer actors collection\n+  ].freeze\n+  attr_reader :link, :name, :country, :release, :producer, :collection\n+\n+  def initialize(hsh = {})\n+    hsh\n+      .keep_if { |key, _| PARAMS.include?(key) }\n+      .each { |key, value| instance_variable_set(\"@#{key}\", value) }\n+  end\n+\n+  def actors\n+    @actors.split(',')\n+  end\n+\n+  def genres\n+    @genres.split(',')\n+  end\n+\n+  def has_attr?(key, value)\n+    attr = public_send(key)\n+    if attr.is_a?(Array)\n+      if value.is_a?(Regexp)\n+        attr.select { |attribute| attribute[value] }.any?\n+      else\n+        attr.include?(value)\n+      end\n+    elsif value.is_a?(Range)\n+      value.include?(attr)\n+    else\n+      attr === value\n+    end\n+  end","path":"movie.rb","position":39,"original_position":39,"commit_id":"fd48022c5cdf119fad08dad33b18a626373e0d6a","original_commit_id":"fd48022c5cdf119fad08dad33b18a626373e0d6a","user":{"login":"zverok","id":129656,"avatar_url":"https://avatars2.githubusercontent.com/u/129656?v=3","gravatar_id":"","url":"https://api.github.com/users/zverok","html_url":"https://github.com/zverok","followers_url":"https://api.github.com/users/zverok/followers","following_url":"https://api.github.com/users/zverok/following{/other_user}","gists_url":"https://api.github.com/users/zverok/gists{/gist_id}","starred_url":"https://api.github.com/users/zverok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zverok/subscriptions","organizations_url":"https://api.github.com/users/zverok/orgs","repos_url":"https://api.github.com/users/zverok/repos","events_url":"https://api.github.com/users/zverok/events{/privacy}","received_events_url":"https://api.github.com/users/zverok/received_events","type":"User","site_admin":false},"body":"Смотри. `===` работает как сравнение с паттерном: \r\n```ruby\r\n2013 === 2013 # => true\r\n(2011..2014) === 2013 # => true\r\n\"Terminator\" === \"Terminator\" # => true\r\n/^term/i === \"Terminator\" # => true\r\n```\r\nСоответственно, случаев тут не 5,5, а всего 2: если аттрибут массив и если просто значение. В остальном `===` хватит для всего.","created_at":"2017-06-20T10:25:45Z","updated_at":"2017-06-20T10:25:45Z","html_url":"https://github.com/esaulkov/movies/pull/4#discussion_r122937516","pull_request_url":"https://api.github.com/repos/esaulkov/movies/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/esaulkov/movies/pulls/comments/122937516"},"html":{"href":"https://github.com/esaulkov/movies/pull/4#discussion_r122937516"},"pull_request":{"href":"https://api.github.com/repos/esaulkov/movies/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/esaulkov/movies/pulls/4","id":126179335,"html_url":"https://github.com/esaulkov/movies/pull/4","diff_url":"https://github.com/esaulkov/movies/pull/4.diff","patch_url":"https://github.com/esaulkov/movies/pull/4.patch","issue_url":"https://api.github.com/repos/esaulkov/movies/issues/4","number":4,"state":"open","locked":false,"title":"feat: rewrite with classes","user":{"login":"esaulkov","id":10377403,"avatar_url":"https://avatars0.githubusercontent.com/u/10377403?v=3","gravatar_id":"","url":"https://api.github.com/users/esaulkov","html_url":"https://github.com/esaulkov","followers_url":"https://api.github.com/users/esaulkov/followers","following_url":"https://api.github.com/users/esaulkov/following{/other_user}","gists_url":"https://api.github.com/users/esaulkov/gists{/gist_id}","starred_url":"https://api.github.com/users/esaulkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esaulkov/subscriptions","organizations_url":"https://api.github.com/users/esaulkov/orgs","repos_url":"https://api.github.com/users/esaulkov/repos","events_url":"https://api.github.com/users/esaulkov/events{/privacy}","received_events_url":"https://api.github.com/users/esaulkov/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-06-18T06:53:42Z","updated_at":"2017-06-20T10:25:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"098e4986a509c6dd5fdb946bbc6d7b3c1599de6d","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/esaulkov/movies/pulls/4/commits","review_comments_url":"https://api.github.com/repos/esaulkov/movies/pulls/4/comments","review_comment_url":"https://api.github.com/repos/esaulkov/movies/pulls/comments{/number}","comments_url":"https://api.github.com/repos/esaulkov/movies/issues/4/comments","statuses_url":"https://api.github.com/repos/esaulkov/movies/statuses/fd48022c5cdf119fad08dad33b18a626373e0d6a","head":{"label":"esaulkov:task5","ref":"task5","sha":"fd48022c5cdf119fad08dad33b18a626373e0d6a","user":{"login":"esaulkov","id":10377403,"avatar_url":"https://avatars0.githubusercontent.com/u/10377403?v=3","gravatar_id":"","url":"https://api.github.com/users/esaulkov","html_url":"https://github.com/esaulkov","followers_url":"https://api.github.com/users/esaulkov/followers","following_url":"https://api.github.com/users/esaulkov/following{/other_user}","gists_url":"https://api.github.com/users/esaulkov/gists{/gist_id}","starred_url":"https://api.github.com/users/esaulkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esaulkov/subscriptions","organizations_url":"https://api.github.com/users/esaulkov/orgs","repos_url":"https://api.github.com/users/esaulkov/repos","events_url":"https://api.github.com/users/esaulkov/events{/privacy}","received_events_url":"https://api.github.com/users/esaulkov/received_events","type":"User","site_admin":false},"repo":{"id":92632644,"name":"movies","full_name":"esaulkov/movies","owner":{"login":"esaulkov","id":10377403,"avatar_url":"https://avatars0.githubusercontent.com/u/10377403?v=3","gravatar_id":"","url":"https://api.github.com/users/esaulkov","html_url":"https://github.com/esaulkov","followers_url":"https://api.github.com/users/esaulkov/followers","following_url":"https://api.github.com/users/esaulkov/following{/other_user}","gists_url":"https://api.github.com/users/esaulkov/gists{/gist_id}","starred_url":"https://api.github.com/users/esaulkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esaulkov/subscriptions","organizations_url":"https://api.github.com/users/esaulkov/orgs","repos_url":"https://api.github.com/users/esaulkov/repos","events_url":"https://api.github.com/users/esaulkov/events{/privacy}","received_events_url":"https://api.github.com/users/esaulkov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/esaulkov/movies","description":"Training project (Ruby)","fork":false,"url":"https://api.github.com/repos/esaulkov/movies","forks_url":"https://api.github.com/repos/esaulkov/movies/forks","keys_url":"https://api.github.com/repos/esaulkov/movies/keys{/key_id}","collaborators_url":"https://api.github.com/repos/esaulkov/movies/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/esaulkov/movies/teams","hooks_url":"https://api.github.com/repos/esaulkov/movies/hooks","issue_events_url":"https://api.github.com/repos/esaulkov/movies/issues/events{/number}","events_url":"https://api.github.com/repos/esaulkov/movies/events","assignees_url":"https://api.github.com/repos/esaulkov/movies/assignees{/user}","branches_url":"https://api.github.com/repos/esaulkov/movies/branches{/branch}","tags_url":"https://api.github.com/repos/esaulkov/movies/tags","blobs_url":"https://api.github.com/repos/esaulkov/movies/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/esaulkov/movies/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/esaulkov/movies/git/refs{/sha}","trees_url":"https://api.github.com/repos/esaulkov/movies/git/trees{/sha}","statuses_url":"https://api.github.com/repos/esaulkov/movies/statuses/{sha}","languages_url":"https://api.github.com/repos/esaulkov/movies/languages","stargazers_url":"https://api.github.com/repos/esaulkov/movies/stargazers","contributors_url":"https://api.github.com/repos/esaulkov/movies/contributors","subscribers_url":"https://api.github.com/repos/esaulkov/movies/subscribers","subscription_url":"https://api.github.com/repos/esaulkov/movies/subscription","commits_url":"https://api.github.com/repos/esaulkov/movies/commits{/sha}","git_commits_url":"https://api.github.com/repos/esaulkov/movies/git/commits{/sha}","comments_url":"https://api.github.com/repos/esaulkov/movies/comments{/number}","issue_comment_url":"https://api.github.com/repos/esaulkov/movies/issues/comments{/number}","contents_url":"https://api.github.com/repos/esaulkov/movies/contents/{+path}","compare_url":"https://api.github.com/repos/esaulkov/movies/compare/{base}...{head}","merges_url":"https://api.github.com/repos/esaulkov/movies/merges","archive_url":"https://api.github.com/repos/esaulkov/movies/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/esaulkov/movies/downloads","issues_url":"https://api.github.com/repos/esaulkov/movies/issues{/number}","pulls_url":"https://api.github.com/repos/esaulkov/movies/pulls{/number}","milestones_url":"https://api.github.com/repos/esaulkov/movies/milestones{/number}","notifications_url":"https://api.github.com/repos/esaulkov/movies/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/esaulkov/movies/labels{/name}","releases_url":"https://api.github.com/repos/esaulkov/movies/releases{/id}","deployments_url":"https://api.github.com/repos/esaulkov/movies/deployments","created_at":"2017-05-28T01:06:56Z","updated_at":"2017-05-30T00:21:19Z","pushed_at":"2017-06-20T03:14:11Z","git_url":"git://github.com/esaulkov/movies.git","ssh_url":"git@github.com:esaulkov/movies.git","clone_url":"https://github.com/esaulkov/movies.git","svn_url":"https://github.com/esaulkov/movies","homepage":null,"size":21,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":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":"esaulkov:master","ref":"master","sha":"164086d1fc1752ed0884b9fff4c0f98110d71d0d","user":{"login":"esaulkov","id":10377403,"avatar_url":"https://avatars0.githubusercontent.com/u/10377403?v=3","gravatar_id":"","url":"https://api.github.com/users/esaulkov","html_url":"https://github.com/esaulkov","followers_url":"https://api.github.com/users/esaulkov/followers","following_url":"https://api.github.com/users/esaulkov/following{/other_user}","gists_url":"https://api.github.com/users/esaulkov/gists{/gist_id}","starred_url":"https://api.github.com/users/esaulkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esaulkov/subscriptions","organizations_url":"https://api.github.com/users/esaulkov/orgs","repos_url":"https://api.github.com/users/esaulkov/repos","events_url":"https://api.github.com/users/esaulkov/events{/privacy}","received_events_url":"https://api.github.com/users/esaulkov/received_events","type":"User","site_admin":false},"repo":{"id":92632644,"name":"movies","full_name":"esaulkov/movies","owner":{"login":"esaulkov","id":10377403,"avatar_url":"https://avatars0.githubusercontent.com/u/10377403?v=3","gravatar_id":"","url":"https://api.github.com/users/esaulkov","html_url":"https://github.com/esaulkov","followers_url":"https://api.github.com/users/esaulkov/followers","following_url":"https://api.github.com/users/esaulkov/following{/other_user}","gists_url":"https://api.github.com/users/esaulkov/gists{/gist_id}","starred_url":"https://api.github.com/users/esaulkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esaulkov/subscriptions","organizations_url":"https://api.github.com/users/esaulkov/orgs","repos_url":"https://api.github.com/users/esaulkov/repos","events_url":"https://api.github.com/users/esaulkov/events{/privacy}","received_events_url":"https://api.github.com/users/esaulkov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/esaulkov/movies","description":"Training project (Ruby)","fork":false,"url":"https://api.github.com/repos/esaulkov/movies","forks_url":"https://api.github.com/repos/esaulkov/movies/forks","keys_url":"https://api.github.com/repos/esaulkov/movies/keys{/key_id}","collaborators_url":"https://api.github.com/repos/esaulkov/movies/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/esaulkov/movies/teams","hooks_url":"https://api.github.com/repos/esaulkov/movies/hooks","issue_events_url":"https://api.github.com/repos/esaulkov/movies/issues/events{/number}","events_url":"https://api.github.com/repos/esaulkov/movies/events","assignees_url":"https://api.github.com/repos/esaulkov/movies/assignees{/user}","branches_url":"https://api.github.com/repos/esaulkov/movies/branches{/branch}","tags_url":"https://api.github.com/repos/esaulkov/movies/tags","blobs_url":"https://api.github.com/repos/esaulkov/movies/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/esaulkov/movies/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/esaulkov/movies/git/refs{/sha}","trees_url":"https://api.github.com/repos/esaulkov/movies/git/trees{/sha}","statuses_url":"https://api.github.com/repos/esaulkov/movies/statuses/{sha}","languages_url":"https://api.github.com/repos/esaulkov/movies/languages","stargazers_url":"https://api.github.com/repos/esaulkov/movies/stargazers","contributors_url":"https://api.github.com/repos/esaulkov/movies/contributors","subscribers_url":"https://api.github.com/repos/esaulkov/movies/subscribers","subscription_url":"https://api.github.com/repos/esaulkov/movies/subscription","commits_url":"https://api.github.com/repos/esaulkov/movies/commits{/sha}","git_commits_url":"https://api.github.com/repos/esaulkov/movies/git/commits{/sha}","comments_url":"https://api.github.com/repos/esaulkov/movies/comments{/number}","issue_comment_url":"https://api.github.com/repos/esaulkov/movies/issues/comments{/number}","contents_url":"https://api.github.com/repos/esaulkov/movies/contents/{+path}","compare_url":"https://api.github.com/repos/esaulkov/movies/compare/{base}...{head}","merges_url":"https://api.github.com/repos/esaulkov/movies/merges","archive_url":"https://api.github.com/repos/esaulkov/movies/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/esaulkov/movies/downloads","issues_url":"https://api.github.com/repos/esaulkov/movies/issues{/number}","pulls_url":"https://api.github.com/repos/esaulkov/movies/pulls{/number}","milestones_url":"https://api.github.com/repos/esaulkov/movies/milestones{/number}","notifications_url":"https://api.github.com/repos/esaulkov/movies/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/esaulkov/movies/labels{/name}","releases_url":"https://api.github.com/repos/esaulkov/movies/releases{/id}","deployments_url":"https://api.github.com/repos/esaulkov/movies/deployments","created_at":"2017-05-28T01:06:56Z","updated_at":"2017-05-30T00:21:19Z","pushed_at":"2017-06-20T03:14:11Z","git_url":"git://github.com/esaulkov/movies.git","ssh_url":"git@github.com:esaulkov/movies.git","clone_url":"https://github.com/esaulkov/movies.git","svn_url":"https://github.com/esaulkov/movies","homepage":null,"size":21,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":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/esaulkov/movies/pulls/4"},"html":{"href":"https://github.com/esaulkov/movies/pull/4"},"issue":{"href":"https://api.github.com/repos/esaulkov/movies/issues/4"},"comments":{"href":"https://api.github.com/repos/esaulkov/movies/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/esaulkov/movies/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/esaulkov/movies/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/esaulkov/movies/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/esaulkov/movies/statuses/fd48022c5cdf119fad08dad33b18a626373e0d6a"}}}}
{"actor":{"display_login":"zverok"}}