You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/08/08 14:54:36 UTC
[PATCH core 3/6] Client: Replaced ambiguous 'require' with require_relative
From: Michal Fojtik <mf...@redhat.com>
* The 'require' was used in weird way that broke MRI 1.9
compatibility.
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
client/lib/base_object.rb | 2 +-
client/lib/deltacloud.rb | 15 ++++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/client/lib/base_object.rb b/client/lib/base_object.rb
index 5f63b5d..5035266 100644
--- a/client/lib/base_object.rb
+++ b/client/lib/base_object.rb
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-require 'string'
+require_relative './string.rb'
module DeltaCloud
diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
index 35fe86d..7caae95 100644
--- a/client/lib/deltacloud.rb
+++ b/client/lib/deltacloud.rb
@@ -17,12 +17,13 @@ require 'nokogiri'
require 'rest_client'
require 'base64'
require 'logger'
-require 'hwp_properties'
-require 'instance_state'
-require 'documentation'
-require 'base_object'
-require 'errors'
-require 'client_bucket_methods'
+require 'require_relative' if RUBY_VERSION =~ /^1\.8/
+require_relative './hwp_properties.rb'
+require_relative './instance_state.rb'
+require_relative './documentation.rb'
+require_relative './base_object.rb'
+require_relative './errors.rb'
+require_relative './client_bucket_methods.rb'
module DeltaCloud
@@ -146,7 +147,7 @@ module DeltaCloud
end
define_method :"fetch_#{model.to_s.singularize}" do |url|
- id = url.grep(/\/#{model}\/(.*)$/)
+ url =~ /\/#{model}\/(.*)$/
self.send(model.to_s.singularize.to_sym, $1)
end
--
1.7.10.2