Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

stop modifying a shared hash

  • Loading branch information...
commit f875a0971a3db708e2ad01d2b07fc155f4d0f7ec 1 parent 8915c08
@technoweenie technoweenie authored
Showing with 7 additions and 11 deletions.
  1. +7 −11 lib/resources.rb
View
18 lib/resources.rb
@@ -692,14 +692,10 @@ def text_html(response, status, head = {})
]
}
- GIST_FILES = {
- "files" => {
- "ring.erl" => {
- "size" => 932,
- "filename" => "ring.erl",
- "raw_url" => "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl"
- }
- }
+ GIST_FILE = {
+ "size" => 932,
+ "filename" => "ring.erl",
+ "raw_url" => "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl"
}
GIST = {
@@ -708,7 +704,7 @@ def text_html(response, status, head = {})
"description" => "description of gist",
"public" => true,
"user" => USER,
- "files" => GIST_FILES,
+ "files" => { "ring.erl" => GIST_FILE },

@technoweenie Can I ask about why files is not returning an *array of Files, but a Hash?

My point is that, when I parse the result of GET /users/:user/gists, having a Hash with the filename as keys is not helpful: I don't know those filenames, so I simply have to iterate through the values, where the filename is also included.

Therefore, it would be easier if files was simply an array of hashes, rather than a hash of hashes. What do you think?

@technoweenie Owner

An array makes sense, but it would be a breaking change. Feel free to talk about it more at support@github.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
"comments" => 0,
"html_url" => "https://gist.github.com/1",
"git_pull_url" => "git://gist.github.com/1.git",
@@ -716,8 +712,8 @@ def text_html(response, status, head = {})
"created_at" => "2010-04-14T02:15:15Z"
}
- FULL_GIST = GIST.merge(GIST_FORKS).merge(GIST_HISTORY).merge(GIST_FILES)
- FULL_GIST['files']['ring.erl']['content'] = 'contents of gist'
+ FULL_GIST = GIST.merge(GIST_FORKS).merge(GIST_HISTORY)
+ FULL_GIST['files'].merge('ring.erl' => GIST_FILE.merge('content' => 'contents of gist'))
GIST_COMMENT = {
"id" => 1,
Please sign in to comment.
Something went wrong with that request. Please try again.