kelredd-resourceful 0.7.6 → 0.7.7

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.
@@ -56,26 +56,26 @@ module Resourceful
56
56
  end
57
57
  end
58
58
 
59
- unless "".respond_to?(:constantize)
59
+ unless "".respond_to?(:resourceful_constantize)
60
60
  if Module.method(:const_get).arity == 1
61
- def constantize #:nodoc:
61
+ def resourceful_constantize #:nodoc:
62
62
  names = self.split('::')
63
63
  names.shift if names.empty? || names.first.empty?
64
64
 
65
65
  constant = ::Object
66
66
  names.each do |name|
67
- constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
67
+ constant = constant.const_defined?(name) ? constant.const_get(name) : raise(NameError.new("uninitialized constant #{self}"))
68
68
  end
69
69
  constant
70
70
  end
71
71
  else # Ruby 1.9 version
72
- def constantize #:nodoc:
72
+ def resourceful_constantize #:nodoc:
73
73
  names = self.split('::')
74
74
  names.shift if names.empty? || names.first.empty?
75
75
 
76
76
  constant = ::Object
77
77
  names.each do |name|
78
- constant = constant.const_get(name, false) || constant.const_missing(name)
78
+ constant = constant.const_get(name, false) || raise(NameError.new("uninitialized constant #{self}"))
79
79
  end
80
80
  constant
81
81
  end
@@ -22,7 +22,7 @@ module Resourceful
22
22
  klass = nil
23
23
  @@namespaces.each do |ns|
24
24
  begin
25
- klass = "#{ns}::#{class_name}".constantize
25
+ klass = "#{ns}::#{class_name}".resourceful_constantize
26
26
  break;
27
27
  rescue Exception => err
28
28
  end
@@ -41,7 +41,7 @@ module Resourceful
41
41
 
42
42
  def self.get_result_data(result, search)
43
43
  hsh_keys = search.kind_of?(String) ? search.split(/\s+/) : nil
44
- result_data = !hsh_keys.nil? && !hsh_keys.empty? && result.respond_to?(:get_value) ? result.get_value(hsh_keys) || result : result
44
+ result_data = !hsh_keys.nil? && !hsh_keys.empty? && result.respond_to?(:get_value) ? (result.get_value(hsh_keys) || result) : result
45
45
  end
46
46
 
47
47
  def self.format
@@ -36,9 +36,9 @@ module Resourceful
36
36
 
37
37
  protected
38
38
 
39
- def push_data(verb, path, opts, data, search="")
39
+ def push_data(verb, path, opts, data, search=nil)
40
40
  result = super(verb, path, opts, data)
41
- result.search(search) || result
41
+ search.nil? ? result : (result.search(search) || result)
42
42
  end
43
43
 
44
44
  def self.format
@@ -3,7 +3,7 @@ module Resourceful
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 7
6
- TINY = 6
6
+ TINY = 7
7
7
 
8
8
  def self.to_s # :nodoc:
9
9
  [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kelredd-resourceful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-15 00:00:00 -07:00
12
+ date: 2009-09-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency