benhoskings-hammock 0.2.15 → 0.2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +6 -0
- data/hammock.gemspec +1 -1
- data/lib/hammock.rb +1 -1
- data/lib/hammock/monkey_patches/object.rb +6 -2
- data/lib/hammock/restful_support.rb +1 -1
- data/lib/hammock/route_step.rb +2 -2
- metadata +1 -1
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.2.15.1 2009-04-15
|
2
|
+
Convert action_name to a symbol instead of a string before checking for ImpliedUnsafeActions.
|
3
|
+
Revert "Switched from #in? to #include? for non-literal args, since it splats into a nested array and breaks."
|
4
|
+
Updated Object#in? to handle array args as well as splatted literal args.
|
5
|
+
|
6
|
+
|
1
7
|
== 0.2.15 2009-04-15
|
2
8
|
Switched from #in? to #include? for non-literal args, since it splats into a nested array and breaks.
|
3
9
|
Moved implied verbs from RouteStep#implied_verb? to a constant.
|
data/hammock.gemspec
CHANGED
data/lib/hammock.rb
CHANGED
@@ -31,8 +31,12 @@ module Hammock
|
|
31
31
|
|
32
32
|
# The reverse of <tt>Enumerable#include?</tt> - returns +true+ if +self+ is
|
33
33
|
# equal to one of the elements of +args+.
|
34
|
-
def in? *
|
35
|
-
|
34
|
+
def in? first, *rest
|
35
|
+
if first.respond_to?(:include?) && rest.empty?
|
36
|
+
first.include? self
|
37
|
+
else
|
38
|
+
[first].concat(rest).include? self
|
39
|
+
end
|
36
40
|
end
|
37
41
|
|
38
42
|
# A symbolized, underscored (i.e. reverse-camelized) representation of +self+.
|
@@ -137,7 +137,7 @@ module Hammock
|
|
137
137
|
end
|
138
138
|
|
139
139
|
def safe_verb_and_implication?
|
140
|
-
request.get? && !Hammock::Constants::ImpliedUnsafeActions
|
140
|
+
request.get? && !action_name.to_sym.in?(Hammock::Constants::ImpliedUnsafeActions)
|
141
141
|
end
|
142
142
|
|
143
143
|
def set_editing
|
data/lib/hammock/route_step.rb
CHANGED
@@ -60,13 +60,13 @@ module Hammock
|
|
60
60
|
def delete?; :delete == http_method end
|
61
61
|
|
62
62
|
def safe?
|
63
|
-
get? && !Hammock::Constants::ImpliedUnsafeActions
|
63
|
+
get? && !verb.in?(Hammock::Constants::ImpliedUnsafeActions)
|
64
64
|
end
|
65
65
|
|
66
66
|
private
|
67
67
|
|
68
68
|
def implied_verb? verb
|
69
|
-
Hammock::Constants::ImpliedVerbs
|
69
|
+
verb.in? Hammock::Constants::ImpliedVerbs
|
70
70
|
end
|
71
71
|
|
72
72
|
def raise_unless_setup_while_trying_to task
|