File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -76,10 +76,14 @@ def auth_token
76
76
#
77
77
# @see http://developer.github.com/v3/gists/
78
78
def gist ( content , options = { } )
79
- filename = options [ :filename ] || "a.rb"
79
+ filename = options [ :filename ] || default_filename
80
80
multi_gist ( { filename => content } , options )
81
81
end
82
82
83
+ def default_filename
84
+ "gistfile1.txt"
85
+ end
86
+
83
87
# Upload a gist to https://gist.github.com
84
88
#
85
89
# @param [Hash] files the code you'd like to gist: filename => content
@@ -114,7 +118,8 @@ def multi_gist(files, options={})
114
118
if content . to_s . strip == ""
115
119
raise "Cannot gist empty files" unless options [ :skip_empty ]
116
120
else
117
- json [ :files ] [ File . basename ( name ) ] = { :content => content }
121
+ name = name == "-" ? default_filename : File . basename ( name )
122
+ json [ :files ] [ name ] = { :content => content }
118
123
end
119
124
end
120
125
You can’t perform that action at this time.
0 commit comments