{"action":"created","comment":{"url":"https://api.github.com/repos/devnacho/mountain_view/pulls/comments/59843413","id":59843413,"diff_hunk":"@@ -0,0 +1,76 @@\n+module MountainView\n+  class Presenter\n+    class_attribute :_properties, instance_accessor: false\n+    self._properties = {}\n+\n+    attr_reader :slug, :properties\n+\n+    def initialize(slug, properties = {})\n+      @slug = slug\n+      @properties = default_properties.deep_merge(properties)\n+    end\n+\n+    def render(context)\n+      context.extend ViewContext\n+      context.inject_component_context(self)\n+      context.render partial: partial\n+    end\n+\n+    def partial\n+      \"#{slug}/#{slug}\"\n+    end\n+\n+    private\n+\n+    def default_properties\n+      self.class._properties.inject({}) do |sum, (k, v)|\n+        sum[k] = v[:default]\n+        sum\n+      end\n+    end\n+\n+    class << self\n+      def component_for(*args)\n+        klass = \"#{args.first.to_s.camelize}Component\".safe_constantize\n+        klass ||= self\n+        klass.new(*args)\n+      end\n+\n+      def properties(*args)\n+        opts = args.extract_options!\n+        properties = args.inject({}) do |sum, name|\n+          sum[name] = opts\n+          sum\n+        end\n+        define_property_methods(args)\n+        self._properties = _properties.merge(properties)\n+      end\n+      alias_method :property, :properties\n+\n+      private \n+\n+      def define_property_methods(names=[])\n+        names.each do |name|\n+          next if method_defined?(name) ","path":"lib/mountain_view/presenter.rb","position":54,"original_position":54,"commit_id":"2503cbade14f16e0681818818e6c72501b5cbf67","original_commit_id":"2503cbade14f16e0681818818e6c72501b5cbf67","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Trailing whitespace detected.","created_at":"2016-04-15T08:40:31Z","updated_at":"2016-04-15T08:40:31Z","html_url":"https://github.com/devnacho/mountain_view/pull/26#discussion_r59843413","pull_request_url":"https://api.github.com/repos/devnacho/mountain_view/pulls/26","_links":{"self":{"href":"https://api.github.com/repos/devnacho/mountain_view/pulls/comments/59843413"},"html":{"href":"https://github.com/devnacho/mountain_view/pull/26#discussion_r59843413"},"pull_request":{"href":"https://api.github.com/repos/devnacho/mountain_view/pulls/26"}}},"pull_request":{"url":"https://api.github.com/repos/devnacho/mountain_view/pulls/26","id":47951753,"html_url":"https://github.com/devnacho/mountain_view/pull/26","diff_url":"https://github.com/devnacho/mountain_view/pull/26.diff","patch_url":"https://github.com/devnacho/mountain_view/pull/26.patch","issue_url":"https://api.github.com/repos/devnacho/mountain_view/issues/26","number":26,"state":"open","locked":false,"title":"Component presenter class","user":{"login":"tombeynon","id":670623,"avatar_url":"https://avatars.githubusercontent.com/u/670623?v=3","gravatar_id":"","url":"https://api.github.com/users/tombeynon","html_url":"https://github.com/tombeynon","followers_url":"https://api.github.com/users/tombeynon/followers","following_url":"https://api.github.com/users/tombeynon/following{/other_user}","gists_url":"https://api.github.com/users/tombeynon/gists{/gist_id}","starred_url":"https://api.github.com/users/tombeynon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tombeynon/subscriptions","organizations_url":"https://api.github.com/users/tombeynon/orgs","repos_url":"https://api.github.com/users/tombeynon/repos","events_url":"https://api.github.com/users/tombeynon/events{/privacy}","received_events_url":"https://api.github.com/users/tombeynon/received_events","type":"User","site_admin":false},"body":"First off - loving MountainView. The front-end team at the agency I work for went nuts over it, but we did find a lot of presentation logic was ending up in the erb files. We usually end up with a large presentation layer in our projects so I figured we could extend MountainView to handle a lot of this logic, and keep the f'enders happy too. \r\n\r\nI noticed this had been raised recently (https://github.com/jgnatch/mountain_view/issues/23) so decided to see if I could come up with a solution you guys would want to merge into master. I've kept everything completely backwards compatible, and tried to keep it as simple and contained as possible. See what you think, I'm definitely open to suggestions.","created_at":"2015-10-16T19:43:06Z","updated_at":"2016-04-15T08:40:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7355fc9b9ce09f9a7541621dbd2803d66bbdd5f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/devnacho/mountain_view/pulls/26/commits","review_comments_url":"https://api.github.com/repos/devnacho/mountain_view/pulls/26/comments","review_comment_url":"https://api.github.com/repos/devnacho/mountain_view/pulls/comments{/number}","comments_url":"https://api.github.com/repos/devnacho/mountain_view/issues/26/comments","statuses_url":"https://api.github.com/repos/devnacho/mountain_view/statuses/2503cbade14f16e0681818818e6c72501b5cbf67","head":{"label":"tombeynon:presenters","ref":"presenters","sha":"2503cbade14f16e0681818818e6c72501b5cbf67","user":{"login":"tombeynon","id":670623,"avatar_url":"https://avatars.githubusercontent.com/u/670623?v=3","gravatar_id":"","url":"https://api.github.com/users/tombeynon","html_url":"https://github.com/tombeynon","followers_url":"https://api.github.com/users/tombeynon/followers","following_url":"https://api.github.com/users/tombeynon/following{/other_user}","gists_url":"https://api.github.com/users/tombeynon/gists{/gist_id}","starred_url":"https://api.github.com/users/tombeynon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tombeynon/subscriptions","organizations_url":"https://api.github.com/users/tombeynon/orgs","repos_url":"https://api.github.com/users/tombeynon/repos","events_url":"https://api.github.com/users/tombeynon/events{/privacy}","received_events_url":"https://api.github.com/users/tombeynon/received_events","type":"User","site_admin":false},"repo":{"id":42616815,"name":"mountain_view","full_name":"tombeynon/mountain_view","owner":{"login":"tombeynon","id":670623,"avatar_url":"https://avatars.githubusercontent.com/u/670623?v=3","gravatar_id":"","url":"https://api.github.com/users/tombeynon","html_url":"https://github.com/tombeynon","followers_url":"https://api.github.com/users/tombeynon/followers","following_url":"https://api.github.com/users/tombeynon/following{/other_user}","gists_url":"https://api.github.com/users/tombeynon/gists{/gist_id}","starred_url":"https://api.github.com/users/tombeynon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tombeynon/subscriptions","organizations_url":"https://api.github.com/users/tombeynon/orgs","repos_url":"https://api.github.com/users/tombeynon/repos","events_url":"https://api.github.com/users/tombeynon/events{/privacy}","received_events_url":"https://api.github.com/users/tombeynon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tombeynon/mountain_view","description":"Living styleguide for Rails","fork":true,"url":"https://api.github.com/repos/tombeynon/mountain_view","forks_url":"https://api.github.com/repos/tombeynon/mountain_view/forks","keys_url":"https://api.github.com/repos/tombeynon/mountain_view/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tombeynon/mountain_view/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tombeynon/mountain_view/teams","hooks_url":"https://api.github.com/repos/tombeynon/mountain_view/hooks","issue_events_url":"https://api.github.com/repos/tombeynon/mountain_view/issues/events{/number}","events_url":"https://api.github.com/repos/tombeynon/mountain_view/events","assignees_url":"https://api.github.com/repos/tombeynon/mountain_view/assignees{/user}","branches_url":"https://api.github.com/repos/tombeynon/mountain_view/branches{/branch}","tags_url":"https://api.github.com/repos/tombeynon/mountain_view/tags","blobs_url":"https://api.github.com/repos/tombeynon/mountain_view/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tombeynon/mountain_view/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tombeynon/mountain_view/git/refs{/sha}","trees_url":"https://api.github.com/repos/tombeynon/mountain_view/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tombeynon/mountain_view/statuses/{sha}","languages_url":"https://api.github.com/repos/tombeynon/mountain_view/languages","stargazers_url":"https://api.github.com/repos/tombeynon/mountain_view/stargazers","contributors_url":"https://api.github.com/repos/tombeynon/mountain_view/contributors","subscribers_url":"https://api.github.com/repos/tombeynon/mountain_view/subscribers","subscription_url":"https://api.github.com/repos/tombeynon/mountain_view/subscription","commits_url":"https://api.github.com/repos/tombeynon/mountain_view/commits{/sha}","git_commits_url":"https://api.github.com/repos/tombeynon/mountain_view/git/commits{/sha}","comments_url":"https://api.github.com/repos/tombeynon/mountain_view/comments{/number}","issue_comment_url":"https://api.github.com/repos/tombeynon/mountain_view/issues/comments{/number}","contents_url":"https://api.github.com/repos/tombeynon/mountain_view/contents/{+path}","compare_url":"https://api.github.com/repos/tombeynon/mountain_view/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tombeynon/mountain_view/merges","archive_url":"https://api.github.com/repos/tombeynon/mountain_view/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tombeynon/mountain_view/downloads","issues_url":"https://api.github.com/repos/tombeynon/mountain_view/issues{/number}","pulls_url":"https://api.github.com/repos/tombeynon/mountain_view/pulls{/number}","milestones_url":"https://api.github.com/repos/tombeynon/mountain_view/milestones{/number}","notifications_url":"https://api.github.com/repos/tombeynon/mountain_view/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tombeynon/mountain_view/labels{/name}","releases_url":"https://api.github.com/repos/tombeynon/mountain_view/releases{/id}","deployments_url":"https://api.github.com/repos/tombeynon/mountain_view/deployments","created_at":"2015-09-16T22:30:29Z","updated_at":"2015-09-21T10:20:49Z","pushed_at":"2016-04-15T08:40:27Z","git_url":"git://github.com/tombeynon/mountain_view.git","ssh_url":"git@github.com:tombeynon/mountain_view.git","clone_url":"https://github.com/tombeynon/mountain_view.git","svn_url":"https://github.com/tombeynon/mountain_view","homepage":"","size":144,"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":"devnacho:master","ref":"master","sha":"14c196a669ab38e10b483b2fe58fc2b46130981b","user":{"login":"devnacho","id":623766,"avatar_url":"https://avatars.githubusercontent.com/u/623766?v=3","gravatar_id":"","url":"https://api.github.com/users/devnacho","html_url":"https://github.com/devnacho","followers_url":"https://api.github.com/users/devnacho/followers","following_url":"https://api.github.com/users/devnacho/following{/other_user}","gists_url":"https://api.github.com/users/devnacho/gists{/gist_id}","starred_url":"https://api.github.com/users/devnacho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devnacho/subscriptions","organizations_url":"https://api.github.com/users/devnacho/orgs","repos_url":"https://api.github.com/users/devnacho/repos","events_url":"https://api.github.com/users/devnacho/events{/privacy}","received_events_url":"https://api.github.com/users/devnacho/received_events","type":"User","site_admin":false},"repo":{"id":32496094,"name":"mountain_view","full_name":"devnacho/mountain_view","owner":{"login":"devnacho","id":623766,"avatar_url":"https://avatars.githubusercontent.com/u/623766?v=3","gravatar_id":"","url":"https://api.github.com/users/devnacho","html_url":"https://github.com/devnacho","followers_url":"https://api.github.com/users/devnacho/followers","following_url":"https://api.github.com/users/devnacho/following{/other_user}","gists_url":"https://api.github.com/users/devnacho/gists{/gist_id}","starred_url":"https://api.github.com/users/devnacho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devnacho/subscriptions","organizations_url":"https://api.github.com/users/devnacho/orgs","repos_url":"https://api.github.com/users/devnacho/repos","events_url":"https://api.github.com/users/devnacho/events{/privacy}","received_events_url":"https://api.github.com/users/devnacho/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/devnacho/mountain_view","description":"Living styleguide for Rails","fork":false,"url":"https://api.github.com/repos/devnacho/mountain_view","forks_url":"https://api.github.com/repos/devnacho/mountain_view/forks","keys_url":"https://api.github.com/repos/devnacho/mountain_view/keys{/key_id}","collaborators_url":"https://api.github.com/repos/devnacho/mountain_view/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/devnacho/mountain_view/teams","hooks_url":"https://api.github.com/repos/devnacho/mountain_view/hooks","issue_events_url":"https://api.github.com/repos/devnacho/mountain_view/issues/events{/number}","events_url":"https://api.github.com/repos/devnacho/mountain_view/events","assignees_url":"https://api.github.com/repos/devnacho/mountain_view/assignees{/user}","branches_url":"https://api.github.com/repos/devnacho/mountain_view/branches{/branch}","tags_url":"https://api.github.com/repos/devnacho/mountain_view/tags","blobs_url":"https://api.github.com/repos/devnacho/mountain_view/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/devnacho/mountain_view/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/devnacho/mountain_view/git/refs{/sha}","trees_url":"https://api.github.com/repos/devnacho/mountain_view/git/trees{/sha}","statuses_url":"https://api.github.com/repos/devnacho/mountain_view/statuses/{sha}","languages_url":"https://api.github.com/repos/devnacho/mountain_view/languages","stargazers_url":"https://api.github.com/repos/devnacho/mountain_view/stargazers","contributors_url":"https://api.github.com/repos/devnacho/mountain_view/contributors","subscribers_url":"https://api.github.com/repos/devnacho/mountain_view/subscribers","subscription_url":"https://api.github.com/repos/devnacho/mountain_view/subscription","commits_url":"https://api.github.com/repos/devnacho/mountain_view/commits{/sha}","git_commits_url":"https://api.github.com/repos/devnacho/mountain_view/git/commits{/sha}","comments_url":"https://api.github.com/repos/devnacho/mountain_view/comments{/number}","issue_comment_url":"https://api.github.com/repos/devnacho/mountain_view/issues/comments{/number}","contents_url":"https://api.github.com/repos/devnacho/mountain_view/contents/{+path}","compare_url":"https://api.github.com/repos/devnacho/mountain_view/compare/{base}...{head}","merges_url":"https://api.github.com/repos/devnacho/mountain_view/merges","archive_url":"https://api.github.com/repos/devnacho/mountain_view/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/devnacho/mountain_view/downloads","issues_url":"https://api.github.com/repos/devnacho/mountain_view/issues{/number}","pulls_url":"https://api.github.com/repos/devnacho/mountain_view/pulls{/number}","milestones_url":"https://api.github.com/repos/devnacho/mountain_view/milestones{/number}","notifications_url":"https://api.github.com/repos/devnacho/mountain_view/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/devnacho/mountain_view/labels{/name}","releases_url":"https://api.github.com/repos/devnacho/mountain_view/releases{/id}","deployments_url":"https://api.github.com/repos/devnacho/mountain_view/deployments","created_at":"2015-03-19T02:24:54Z","updated_at":"2016-04-07T16:52:16Z","pushed_at":"2016-04-15T08:40:28Z","git_url":"git://github.com/devnacho/mountain_view.git","ssh_url":"git@github.com:devnacho/mountain_view.git","clone_url":"https://github.com/devnacho/mountain_view.git","svn_url":"https://github.com/devnacho/mountain_view","homepage":"","size":214,"stargazers_count":142,"watchers_count":142,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":9,"forks":16,"open_issues":9,"watchers":142,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/devnacho/mountain_view/pulls/26"},"html":{"href":"https://github.com/devnacho/mountain_view/pull/26"},"issue":{"href":"https://api.github.com/repos/devnacho/mountain_view/issues/26"},"comments":{"href":"https://api.github.com/repos/devnacho/mountain_view/issues/26/comments"},"review_comments":{"href":"https://api.github.com/repos/devnacho/mountain_view/pulls/26/comments"},"review_comment":{"href":"https://api.github.com/repos/devnacho/mountain_view/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/devnacho/mountain_view/pulls/26/commits"},"statuses":{"href":"https://api.github.com/repos/devnacho/mountain_view/statuses/2503cbade14f16e0681818818e6c72501b5cbf67"}}}}