{"action":"created","comment":{"url":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls/comments/49365808","id":49365808,"diff_hunk":"@@ -473,8 +479,49 @@ def self.with_auto_vars(n_vars)\n     #\n     # This ensures that a single value passed is not put in an array, so\n     # <code>query.add([1, 2])</code> will work as well as <code>query.add(1, 2)</code>.\n-    def self.varargs(values)\n+    def varargs(values)\n       values.length == 1 ? values[0] : values\n     end\n   end\n+\n+  def query(&block)\n+    return nil if block.nil?\n+\n+    ctx = eval('self', block.binding)\n+    dsl = DSLContext.new(ctx)\n+\n+    ctx.instance_variables.each do |iv|\n+      dsl.instance_variable_set(iv, ctx.instance_variable_get(iv))\n+    end\n+\n+    dsl.instance_exec(&block)\n+\n+  ensure\n+    dsl.instance_variables.each do |iv|\n+      if iv.to_sym != :@__ctx__\n+        ctx.instance_variable_set(iv, dsl.instance_variable_get(iv))\n+      end\n+    end\n+  end\n+\n+  class DSLContext","path":"lib/fauna/query.rb","position":490,"original_position":490,"commit_id":"ee414af4bde6f362dad7c9dfdbb6a49bea6a7e52","original_commit_id":"ee414af4bde6f362dad7c9dfdbb6a49bea6a7e52","user":{"login":"andy-faunadb","id":13004842,"avatar_url":"https://avatars.githubusercontent.com/u/13004842?v=3","gravatar_id":"","url":"https://api.github.com/users/andy-faunadb","html_url":"https://github.com/andy-faunadb","followers_url":"https://api.github.com/users/andy-faunadb/followers","following_url":"https://api.github.com/users/andy-faunadb/following{/other_user}","gists_url":"https://api.github.com/users/andy-faunadb/gists{/gist_id}","starred_url":"https://api.github.com/users/andy-faunadb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy-faunadb/subscriptions","organizations_url":"https://api.github.com/users/andy-faunadb/orgs","repos_url":"https://api.github.com/users/andy-faunadb/repos","events_url":"https://api.github.com/users/andy-faunadb/events{/privacy}","received_events_url":"https://api.github.com/users/andy-faunadb/received_events","type":"User","site_admin":false},"body":"This should be documented or have `:nodoc:`.","created_at":"2016-01-11T19:26:27Z","updated_at":"2016-01-11T19:26:27Z","html_url":"https://github.com/faunadb/faunadb-ruby/pull/110#discussion_r49365808","pull_request_url":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls/110","_links":{"self":{"href":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls/comments/49365808"},"html":{"href":"https://github.com/faunadb/faunadb-ruby/pull/110#discussion_r49365808"},"pull_request":{"href":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls/110"}}},"pull_request":{"url":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls/110","id":55497996,"html_url":"https://github.com/faunadb/faunadb-ruby/pull/110","diff_url":"https://github.com/faunadb/faunadb-ruby/pull/110.diff","patch_url":"https://github.com/faunadb/faunadb-ruby/pull/110.patch","issue_url":"https://api.github.com/repos/faunadb/faunadb-ruby/issues/110","number":110,"state":"open","locked":false,"title":"dsl context block helper","user":{"login":"freels","id":1407,"avatar_url":"https://avatars.githubusercontent.com/u/1407?v=3","gravatar_id":"","url":"https://api.github.com/users/freels","html_url":"https://github.com/freels","followers_url":"https://api.github.com/users/freels/followers","following_url":"https://api.github.com/users/freels/following{/other_user}","gists_url":"https://api.github.com/users/freels/gists{/gist_id}","starred_url":"https://api.github.com/users/freels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freels/subscriptions","organizations_url":"https://api.github.com/users/freels/orgs","repos_url":"https://api.github.com/users/freels/repos","events_url":"https://api.github.com/users/freels/events{/privacy}","received_events_url":"https://api.github.com/users/freels/received_events","type":"User","site_admin":false},"body":"Provides a helper to build a query using the dsl in an unscoped fashion:\r\n\r\n```ruby\r\ninclude Fauna\r\n\r\nquery do \r\n  create Ref.new('classes/foo'), object(data: object(foo: 'bar'))\r\nend\r\n```","created_at":"2016-01-08T19:08:52Z","updated_at":"2016-01-11T19:26:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ace8baf5c2247ce794597317cf797a38324f16a3","assignee":{"login":"ashfire908","id":225779,"avatar_url":"https://avatars.githubusercontent.com/u/225779?v=3","gravatar_id":"","url":"https://api.github.com/users/ashfire908","html_url":"https://github.com/ashfire908","followers_url":"https://api.github.com/users/ashfire908/followers","following_url":"https://api.github.com/users/ashfire908/following{/other_user}","gists_url":"https://api.github.com/users/ashfire908/gists{/gist_id}","starred_url":"https://api.github.com/users/ashfire908/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashfire908/subscriptions","organizations_url":"https://api.github.com/users/ashfire908/orgs","repos_url":"https://api.github.com/users/ashfire908/repos","events_url":"https://api.github.com/users/ashfire908/events{/privacy}","received_events_url":"https://api.github.com/users/ashfire908/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls/110/commits","review_comments_url":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls/110/comments","review_comment_url":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/faunadb/faunadb-ruby/issues/110/comments","statuses_url":"https://api.github.com/repos/faunadb/faunadb-ruby/statuses/ee414af4bde6f362dad7c9dfdbb6a49bea6a7e52","head":{"label":"faunadb:dsl_ctx_block","ref":"dsl_ctx_block","sha":"ee414af4bde6f362dad7c9dfdbb6a49bea6a7e52","user":{"login":"faunadb","id":1477000,"avatar_url":"https://avatars.githubusercontent.com/u/1477000?v=3","gravatar_id":"","url":"https://api.github.com/users/faunadb","html_url":"https://github.com/faunadb","followers_url":"https://api.github.com/users/faunadb/followers","following_url":"https://api.github.com/users/faunadb/following{/other_user}","gists_url":"https://api.github.com/users/faunadb/gists{/gist_id}","starred_url":"https://api.github.com/users/faunadb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faunadb/subscriptions","organizations_url":"https://api.github.com/users/faunadb/orgs","repos_url":"https://api.github.com/users/faunadb/repos","events_url":"https://api.github.com/users/faunadb/events{/privacy}","received_events_url":"https://api.github.com/users/faunadb/received_events","type":"Organization","site_admin":false},"repo":{"id":7089764,"name":"faunadb-ruby","full_name":"faunadb/faunadb-ruby","owner":{"login":"faunadb","id":1477000,"avatar_url":"https://avatars.githubusercontent.com/u/1477000?v=3","gravatar_id":"","url":"https://api.github.com/users/faunadb","html_url":"https://github.com/faunadb","followers_url":"https://api.github.com/users/faunadb/followers","following_url":"https://api.github.com/users/faunadb/following{/other_user}","gists_url":"https://api.github.com/users/faunadb/gists{/gist_id}","starred_url":"https://api.github.com/users/faunadb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faunadb/subscriptions","organizations_url":"https://api.github.com/users/faunadb/orgs","repos_url":"https://api.github.com/users/faunadb/repos","events_url":"https://api.github.com/users/faunadb/events{/privacy}","received_events_url":"https://api.github.com/users/faunadb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/faunadb/faunadb-ruby","description":"Ruby client for Fauna. Owner: Andrew","fork":false,"url":"https://api.github.com/repos/faunadb/faunadb-ruby","forks_url":"https://api.github.com/repos/faunadb/faunadb-ruby/forks","keys_url":"https://api.github.com/repos/faunadb/faunadb-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/faunadb/faunadb-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/faunadb/faunadb-ruby/teams","hooks_url":"https://api.github.com/repos/faunadb/faunadb-ruby/hooks","issue_events_url":"https://api.github.com/repos/faunadb/faunadb-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/faunadb/faunadb-ruby/events","assignees_url":"https://api.github.com/repos/faunadb/faunadb-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/faunadb/faunadb-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/faunadb/faunadb-ruby/tags","blobs_url":"https://api.github.com/repos/faunadb/faunadb-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/faunadb/faunadb-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/faunadb/faunadb-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/faunadb/faunadb-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/faunadb/faunadb-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/faunadb/faunadb-ruby/languages","stargazers_url":"https://api.github.com/repos/faunadb/faunadb-ruby/stargazers","contributors_url":"https://api.github.com/repos/faunadb/faunadb-ruby/contributors","subscribers_url":"https://api.github.com/repos/faunadb/faunadb-ruby/subscribers","subscription_url":"https://api.github.com/repos/faunadb/faunadb-ruby/subscription","commits_url":"https://api.github.com/repos/faunadb/faunadb-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/faunadb/faunadb-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/faunadb/faunadb-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/faunadb/faunadb-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/faunadb/faunadb-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/faunadb/faunadb-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/faunadb/faunadb-ruby/merges","archive_url":"https://api.github.com/repos/faunadb/faunadb-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/faunadb/faunadb-ruby/downloads","issues_url":"https://api.github.com/repos/faunadb/faunadb-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/faunadb/faunadb-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/faunadb/faunadb-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/faunadb/faunadb-ruby/labels{/name}","releases_url":"https://api.github.com/repos/faunadb/faunadb-ruby/releases{/id}","created_at":"2012-12-10T08:15:38Z","updated_at":"2016-01-11T19:01:47Z","pushed_at":"2016-01-11T19:14:48Z","git_url":"git://github.com/faunadb/faunadb-ruby.git","ssh_url":"git@github.com:faunadb/faunadb-ruby.git","clone_url":"https://github.com/faunadb/faunadb-ruby.git","svn_url":"https://github.com/faunadb/faunadb-ruby","homepage":"https://faunadb.com","size":593,"stargazers_count":12,"watchers_count":12,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":9,"forks":11,"open_issues":9,"watchers":12,"default_branch":"master"}},"base":{"label":"faunadb:master","ref":"master","sha":"748c6bc6e6b2a3374d23ccef9c9327579d82bcb3","user":{"login":"faunadb","id":1477000,"avatar_url":"https://avatars.githubusercontent.com/u/1477000?v=3","gravatar_id":"","url":"https://api.github.com/users/faunadb","html_url":"https://github.com/faunadb","followers_url":"https://api.github.com/users/faunadb/followers","following_url":"https://api.github.com/users/faunadb/following{/other_user}","gists_url":"https://api.github.com/users/faunadb/gists{/gist_id}","starred_url":"https://api.github.com/users/faunadb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faunadb/subscriptions","organizations_url":"https://api.github.com/users/faunadb/orgs","repos_url":"https://api.github.com/users/faunadb/repos","events_url":"https://api.github.com/users/faunadb/events{/privacy}","received_events_url":"https://api.github.com/users/faunadb/received_events","type":"Organization","site_admin":false},"repo":{"id":7089764,"name":"faunadb-ruby","full_name":"faunadb/faunadb-ruby","owner":{"login":"faunadb","id":1477000,"avatar_url":"https://avatars.githubusercontent.com/u/1477000?v=3","gravatar_id":"","url":"https://api.github.com/users/faunadb","html_url":"https://github.com/faunadb","followers_url":"https://api.github.com/users/faunadb/followers","following_url":"https://api.github.com/users/faunadb/following{/other_user}","gists_url":"https://api.github.com/users/faunadb/gists{/gist_id}","starred_url":"https://api.github.com/users/faunadb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faunadb/subscriptions","organizations_url":"https://api.github.com/users/faunadb/orgs","repos_url":"https://api.github.com/users/faunadb/repos","events_url":"https://api.github.com/users/faunadb/events{/privacy}","received_events_url":"https://api.github.com/users/faunadb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/faunadb/faunadb-ruby","description":"Ruby client for Fauna. Owner: Andrew","fork":false,"url":"https://api.github.com/repos/faunadb/faunadb-ruby","forks_url":"https://api.github.com/repos/faunadb/faunadb-ruby/forks","keys_url":"https://api.github.com/repos/faunadb/faunadb-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/faunadb/faunadb-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/faunadb/faunadb-ruby/teams","hooks_url":"https://api.github.com/repos/faunadb/faunadb-ruby/hooks","issue_events_url":"https://api.github.com/repos/faunadb/faunadb-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/faunadb/faunadb-ruby/events","assignees_url":"https://api.github.com/repos/faunadb/faunadb-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/faunadb/faunadb-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/faunadb/faunadb-ruby/tags","blobs_url":"https://api.github.com/repos/faunadb/faunadb-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/faunadb/faunadb-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/faunadb/faunadb-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/faunadb/faunadb-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/faunadb/faunadb-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/faunadb/faunadb-ruby/languages","stargazers_url":"https://api.github.com/repos/faunadb/faunadb-ruby/stargazers","contributors_url":"https://api.github.com/repos/faunadb/faunadb-ruby/contributors","subscribers_url":"https://api.github.com/repos/faunadb/faunadb-ruby/subscribers","subscription_url":"https://api.github.com/repos/faunadb/faunadb-ruby/subscription","commits_url":"https://api.github.com/repos/faunadb/faunadb-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/faunadb/faunadb-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/faunadb/faunadb-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/faunadb/faunadb-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/faunadb/faunadb-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/faunadb/faunadb-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/faunadb/faunadb-ruby/merges","archive_url":"https://api.github.com/repos/faunadb/faunadb-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/faunadb/faunadb-ruby/downloads","issues_url":"https://api.github.com/repos/faunadb/faunadb-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/faunadb/faunadb-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/faunadb/faunadb-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/faunadb/faunadb-ruby/labels{/name}","releases_url":"https://api.github.com/repos/faunadb/faunadb-ruby/releases{/id}","created_at":"2012-12-10T08:15:38Z","updated_at":"2016-01-11T19:01:47Z","pushed_at":"2016-01-11T19:14:48Z","git_url":"git://github.com/faunadb/faunadb-ruby.git","ssh_url":"git@github.com:faunadb/faunadb-ruby.git","clone_url":"https://github.com/faunadb/faunadb-ruby.git","svn_url":"https://github.com/faunadb/faunadb-ruby","homepage":"https://faunadb.com","size":593,"stargazers_count":12,"watchers_count":12,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":9,"forks":11,"open_issues":9,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls/110"},"html":{"href":"https://github.com/faunadb/faunadb-ruby/pull/110"},"issue":{"href":"https://api.github.com/repos/faunadb/faunadb-ruby/issues/110"},"comments":{"href":"https://api.github.com/repos/faunadb/faunadb-ruby/issues/110/comments"},"review_comments":{"href":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls/110/comments"},"review_comment":{"href":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/faunadb/faunadb-ruby/pulls/110/commits"},"statuses":{"href":"https://api.github.com/repos/faunadb/faunadb-ruby/statuses/ee414af4bde6f362dad7c9dfdbb6a49bea6a7e52"}}}}