{"action":"created","comment":{"url":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls/comments/27049629","id":27049629,"diff_hunk":"@@ -46,9 +43,161 @@ def initialize(origin, value,\n   def_delegators :@value, :[], :has_key?, :has_value?, :empty?, :size, :keys, :values, :each, :map\n \n \n+  def with_only_key(key)\n+    with_only_path(Path.new_key(key))\n+  end\n+\n+  def without_key(key)\n+    without_path(Path.new_key(key))\n+  end\n+\n+  # gets the object with only the path if the path\n+  # exists, otherwise null if it doesn't. this ensures\n+  # that if we have { a : { b : 42 } } and do\n+  # withOnlyPath(\"a.b.c\") that we don't keep an empty\n+  # \"a\" object.\n+  def with_only_path_or_nil(path)\n+    key = path.first\n+    path_next = path.remainder\n+    v = value[key]\n+\n+    if ! path_next.nil?\n+      if (!v.nil?) && (v.is_a?(Hocon::Impl::AbstractConfigObject))\n+        v = v.with_only_path_or_nil(path_next)\n+      else\n+        # if the path has more elements but we don't have an object,\n+        # then the rest of the path does not exist.\n+        v = nil\n+      end\n+    end\n+\n+    if v.nil?\n+      nil\n+    else\n+      self.class.new(origin, {key => v}, v.resolve_status, @ignores_fallbacks)\n+    end\n+  end\n+\n+  def with_only_path(path)\n+    o = with_only_path_or_nil(path)\n+    if o.nil?\n+      self.class.new(origin, {}, ResolveStatus::RESOLVED, @ignores_fallbacks)\n+    else\n+      o\n+    end\n+  end\n+\n+  def without_path(path)\n+    key = path.first\n+    remainder = path.remainder\n+    v = @value[key]\n+\n+    if (not v.nil?) && (not remainder.nil?) && v.is_a?(Hocon::Impl::AbstractConfigObject)\n+      v = v.without_path(remainder)\n+      updated = @value.clone\n+      updated[key] = v\n+      Hocon::Impl::SimpleConfigObject.new(origin,\n+                                          updated,\n+                                          ResolveStatus.from_values(updated.values), @ignores_fallbacks)","path":"lib/hocon/impl/simple_config_object.rb","position":87,"original_position":87,"commit_id":"ee244518864603241a890e047a3a9b94c2d553cf","original_commit_id":"ee244518864603241a890e047a3a9b94c2d553cf","user":{"login":"KevinCorcoran","id":2945462,"avatar_url":"https://avatars.githubusercontent.com/u/2945462?v=3","gravatar_id":"","url":"https://api.github.com/users/KevinCorcoran","html_url":"https://github.com/KevinCorcoran","followers_url":"https://api.github.com/users/KevinCorcoran/followers","following_url":"https://api.github.com/users/KevinCorcoran/following{/other_user}","gists_url":"https://api.github.com/users/KevinCorcoran/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinCorcoran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinCorcoran/subscriptions","organizations_url":"https://api.github.com/users/KevinCorcoran/orgs","repos_url":"https://api.github.com/users/KevinCorcoran/repos","events_url":"https://api.github.com/users/KevinCorcoran/events{/privacy}","received_events_url":"https://api.github.com/users/KevinCorcoran/received_events","type":"User","site_admin":false},"body":"ditto","created_at":"2015-03-24T17:05:18Z","updated_at":"2015-03-24T17:05:18Z","html_url":"https://github.com/puppetlabs/ruby-hocon/pull/34#discussion_r27049629","pull_request_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls/comments/27049629"},"html":{"href":"https://github.com/puppetlabs/ruby-hocon/pull/34#discussion_r27049629"},"pull_request":{"href":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls/34","id":31776575,"html_url":"https://github.com/puppetlabs/ruby-hocon/pull/34","diff_url":"https://github.com/puppetlabs/ruby-hocon/pull/34.diff","patch_url":"https://github.com/puppetlabs/ruby-hocon/pull/34.patch","issue_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/issues/34","number":34,"state":"open","locked":false,"title":"(MAINT) flesh out simple config object","user":{"login":"cprice404","id":1341071,"avatar_url":"https://avatars.githubusercontent.com/u/1341071?v=3","gravatar_id":"","url":"https://api.github.com/users/cprice404","html_url":"https://github.com/cprice404","followers_url":"https://api.github.com/users/cprice404/followers","following_url":"https://api.github.com/users/cprice404/following{/other_user}","gists_url":"https://api.github.com/users/cprice404/gists{/gist_id}","starred_url":"https://api.github.com/users/cprice404/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cprice404/subscriptions","organizations_url":"https://api.github.com/users/cprice404/orgs","repos_url":"https://api.github.com/users/cprice404/repos","events_url":"https://api.github.com/users/cprice404/events{/privacy}","received_events_url":"https://api.github.com/users/cprice404/received_events","type":"User","site_admin":false},"body":"This commit cleans up the order of the code in `SimpleConfigObject` to more closely mirror that of the upstream, and also ports over a bunch of stuff that hadn't been ported yet.","created_at":"2015-03-23T21:36:24Z","updated_at":"2015-03-24T17:05:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d61a04236082db06f9262b8528a0d0465868c4d3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls/34/commits","review_comments_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls/34/comments","review_comment_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/issues/34/comments","statuses_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/statuses/ee244518864603241a890e047a3a9b94c2d553cf","head":{"label":"cprice404:maint/master/flesh-out-simple-config-object","ref":"maint/master/flesh-out-simple-config-object","sha":"ee244518864603241a890e047a3a9b94c2d553cf","user":{"login":"cprice404","id":1341071,"avatar_url":"https://avatars.githubusercontent.com/u/1341071?v=3","gravatar_id":"","url":"https://api.github.com/users/cprice404","html_url":"https://github.com/cprice404","followers_url":"https://api.github.com/users/cprice404/followers","following_url":"https://api.github.com/users/cprice404/following{/other_user}","gists_url":"https://api.github.com/users/cprice404/gists{/gist_id}","starred_url":"https://api.github.com/users/cprice404/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cprice404/subscriptions","organizations_url":"https://api.github.com/users/cprice404/orgs","repos_url":"https://api.github.com/users/cprice404/repos","events_url":"https://api.github.com/users/cprice404/events{/privacy}","received_events_url":"https://api.github.com/users/cprice404/received_events","type":"User","site_admin":false},"repo":{"id":32554335,"name":"ruby-hocon","full_name":"cprice404/ruby-hocon","owner":{"login":"cprice404","id":1341071,"avatar_url":"https://avatars.githubusercontent.com/u/1341071?v=3","gravatar_id":"","url":"https://api.github.com/users/cprice404","html_url":"https://github.com/cprice404","followers_url":"https://api.github.com/users/cprice404/followers","following_url":"https://api.github.com/users/cprice404/following{/other_user}","gists_url":"https://api.github.com/users/cprice404/gists{/gist_id}","starred_url":"https://api.github.com/users/cprice404/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cprice404/subscriptions","organizations_url":"https://api.github.com/users/cprice404/orgs","repos_url":"https://api.github.com/users/cprice404/repos","events_url":"https://api.github.com/users/cprice404/events{/privacy}","received_events_url":"https://api.github.com/users/cprice404/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cprice404/ruby-hocon","description":"","fork":true,"url":"https://api.github.com/repos/cprice404/ruby-hocon","forks_url":"https://api.github.com/repos/cprice404/ruby-hocon/forks","keys_url":"https://api.github.com/repos/cprice404/ruby-hocon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cprice404/ruby-hocon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cprice404/ruby-hocon/teams","hooks_url":"https://api.github.com/repos/cprice404/ruby-hocon/hooks","issue_events_url":"https://api.github.com/repos/cprice404/ruby-hocon/issues/events{/number}","events_url":"https://api.github.com/repos/cprice404/ruby-hocon/events","assignees_url":"https://api.github.com/repos/cprice404/ruby-hocon/assignees{/user}","branches_url":"https://api.github.com/repos/cprice404/ruby-hocon/branches{/branch}","tags_url":"https://api.github.com/repos/cprice404/ruby-hocon/tags","blobs_url":"https://api.github.com/repos/cprice404/ruby-hocon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cprice404/ruby-hocon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cprice404/ruby-hocon/git/refs{/sha}","trees_url":"https://api.github.com/repos/cprice404/ruby-hocon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cprice404/ruby-hocon/statuses/{sha}","languages_url":"https://api.github.com/repos/cprice404/ruby-hocon/languages","stargazers_url":"https://api.github.com/repos/cprice404/ruby-hocon/stargazers","contributors_url":"https://api.github.com/repos/cprice404/ruby-hocon/contributors","subscribers_url":"https://api.github.com/repos/cprice404/ruby-hocon/subscribers","subscription_url":"https://api.github.com/repos/cprice404/ruby-hocon/subscription","commits_url":"https://api.github.com/repos/cprice404/ruby-hocon/commits{/sha}","git_commits_url":"https://api.github.com/repos/cprice404/ruby-hocon/git/commits{/sha}","comments_url":"https://api.github.com/repos/cprice404/ruby-hocon/comments{/number}","issue_comment_url":"https://api.github.com/repos/cprice404/ruby-hocon/issues/comments{/number}","contents_url":"https://api.github.com/repos/cprice404/ruby-hocon/contents/{+path}","compare_url":"https://api.github.com/repos/cprice404/ruby-hocon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cprice404/ruby-hocon/merges","archive_url":"https://api.github.com/repos/cprice404/ruby-hocon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cprice404/ruby-hocon/downloads","issues_url":"https://api.github.com/repos/cprice404/ruby-hocon/issues{/number}","pulls_url":"https://api.github.com/repos/cprice404/ruby-hocon/pulls{/number}","milestones_url":"https://api.github.com/repos/cprice404/ruby-hocon/milestones{/number}","notifications_url":"https://api.github.com/repos/cprice404/ruby-hocon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cprice404/ruby-hocon/labels{/name}","releases_url":"https://api.github.com/repos/cprice404/ruby-hocon/releases{/id}","created_at":"2015-03-20T00:49:03Z","updated_at":"2015-03-20T00:49:04Z","pushed_at":"2015-03-23T23:56:59Z","git_url":"git://github.com/cprice404/ruby-hocon.git","ssh_url":"git@github.com:cprice404/ruby-hocon.git","clone_url":"https://github.com/cprice404/ruby-hocon.git","svn_url":"https://github.com/cprice404/ruby-hocon","homepage":null,"size":516,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"puppetlabs:master","ref":"master","sha":"f980ff46882763f87c1bbf1577c02c1c0670eef4","user":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":17326988,"name":"ruby-hocon","full_name":"puppetlabs/ruby-hocon","owner":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/puppetlabs/ruby-hocon","description":"","fork":false,"url":"https://api.github.com/repos/puppetlabs/ruby-hocon","forks_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/forks","keys_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/teams","hooks_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/hooks","issue_events_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/issues/events{/number}","events_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/events","assignees_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/assignees{/user}","branches_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/branches{/branch}","tags_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/tags","blobs_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/git/refs{/sha}","trees_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/statuses/{sha}","languages_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/languages","stargazers_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/stargazers","contributors_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/contributors","subscribers_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/subscribers","subscription_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/subscription","commits_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/commits{/sha}","git_commits_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/git/commits{/sha}","comments_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/comments{/number}","issue_comment_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/issues/comments{/number}","contents_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/contents/{+path}","compare_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/merges","archive_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/downloads","issues_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/issues{/number}","pulls_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls{/number}","milestones_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/milestones{/number}","notifications_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/labels{/name}","releases_url":"https://api.github.com/repos/puppetlabs/ruby-hocon/releases{/id}","created_at":"2014-03-01T23:44:17Z","updated_at":"2015-03-23T23:45:06Z","pushed_at":"2015-03-23T23:56:59Z","git_url":"git://github.com/puppetlabs/ruby-hocon.git","ssh_url":"git@github.com:puppetlabs/ruby-hocon.git","clone_url":"https://github.com/puppetlabs/ruby-hocon.git","svn_url":"https://github.com/puppetlabs/ruby-hocon","homepage":null,"size":1055,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls/34"},"html":{"href":"https://github.com/puppetlabs/ruby-hocon/pull/34"},"issue":{"href":"https://api.github.com/repos/puppetlabs/ruby-hocon/issues/34"},"comments":{"href":"https://api.github.com/repos/puppetlabs/ruby-hocon/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/puppetlabs/ruby-hocon/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/puppetlabs/ruby-hocon/statuses/ee244518864603241a890e047a3a9b94c2d553cf"}}}}