clutterbuck-response 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/clutterbuck-response.gemspec +1 -0
- data/lib/clutterbuck/response.rb +27 -0
- metadata +17 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63bb4a9b049aa78afdd9d5e09c45308a3d2e346f
|
4
|
+
data.tar.gz: '07758f6c22448a4c0a7700c68040e6d1f859193d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 581c9712c6915741e1d68d0a3ca613de8e04958cb6a7cec963b9d80bbf1b409c2cc6426f217c286af53f307e721acbe02696136fb7dfeffee01eb1f15fcd8c6e
|
7
|
+
data.tar.gz: 816ac443d7b883a8374ea781178173a91f21c1e572c2b954daca2453013efa1ef2961e6d15d0b4ee7691bf0505e28b3e41750f1f4f499215824ab71739390648
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
|
23
23
|
s.add_development_dependency 'bundler'
|
24
24
|
s.add_development_dependency 'github-release'
|
25
|
+
s.add_development_dependency 'git-version-bump'
|
25
26
|
s.add_development_dependency 'guard-spork'
|
26
27
|
s.add_development_dependency 'guard-rspec'
|
27
28
|
s.add_development_dependency 'rake', '~> 10.4', '>= 10.4.2'
|
data/lib/clutterbuck/response.rb
CHANGED
@@ -75,6 +75,29 @@ module Clutterbuck::Response
|
|
75
75
|
@headers.select { |h| h[0] == name }.map { |h| h[1] }
|
76
76
|
end
|
77
77
|
|
78
|
+
# Set the response body.
|
79
|
+
#
|
80
|
+
# Any ol' string or array you might like to create.
|
81
|
+
#
|
82
|
+
# @param body [String, Array<#to_s>] the body to set.
|
83
|
+
#
|
84
|
+
# @return [nil]
|
85
|
+
#
|
86
|
+
def set_body(body)
|
87
|
+
@body = body.respond_to(:each) ? body : [body]
|
88
|
+
end
|
89
|
+
|
90
|
+
# Convenience method for defining a temporary redirect.
|
91
|
+
#
|
92
|
+
# Redirecting a request to a new URL is such a common operation that
|
93
|
+
# it's nice to be able to do it in one call, rather than two.
|
94
|
+
#
|
95
|
+
def redirect(url)
|
96
|
+
status 303
|
97
|
+
set_header "Location", url
|
98
|
+
set_body ""
|
99
|
+
end
|
100
|
+
|
78
101
|
#:nodoc:
|
79
102
|
#
|
80
103
|
# Override the default `call` method which (we hope) the application is
|
@@ -99,6 +122,10 @@ module Clutterbuck::Response
|
|
99
122
|
h += @headers
|
100
123
|
end
|
101
124
|
|
125
|
+
if @body
|
126
|
+
b = @body
|
127
|
+
end
|
128
|
+
|
102
129
|
[s, h, b]
|
103
130
|
end
|
104
131
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clutterbuck-response
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Palmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: git-version-bump
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: guard-spork
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,9 +190,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
190
|
version: '0'
|
177
191
|
requirements: []
|
178
192
|
rubyforge_project:
|
179
|
-
rubygems_version: 2.2.
|
193
|
+
rubygems_version: 2.5.2.1
|
180
194
|
signing_key:
|
181
195
|
specification_version: 4
|
182
196
|
summary: A template gem
|
183
197
|
test_files: []
|
184
|
-
has_rdoc:
|