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 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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{hammock}
5
- s.version = "0.2.15"
5
+ s.version = "0.2.15.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ben Hoskings"]
data/lib/hammock.rb CHANGED
@@ -4,7 +4,7 @@ require 'ambition'
4
4
  require 'ambition/adapters/active_record'
5
5
 
6
6
  module Hammock
7
- VERSION = '0.2.15'
7
+ VERSION = '0.2.15.1'
8
8
 
9
9
  def self.included base # :nodoc:
10
10
  puts "Loading Hammock from #{loaded_from_gem? ? 'gem' : 'plugin'}"
@@ -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? *args
35
- args.include? self
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.include?(action_name.to_sym)
140
+ request.get? && !action_name.to_sym.in?(Hammock::Constants::ImpliedUnsafeActions)
141
141
  end
142
142
 
143
143
  def set_editing
@@ -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.include?(verb)
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.include? verb
69
+ verb.in? Hammock::Constants::ImpliedVerbs
70
70
  end
71
71
 
72
72
  def raise_unless_setup_while_trying_to task
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benhoskings-hammock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.15
4
+ version: 0.2.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Hoskings