Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

quashed some interpreter warnings

  • Loading branch information...
commit 0cc0f36ac3d4ada59f748f405387ffd87de37e4a 1 parent a16ac93
Philip (flip) Kromer authored
View
2  lib/wukong.rb
@@ -1,5 +1,5 @@
-require 'configliere'; Settings.use :define
require 'wukong/extensions'
+require 'configliere'; Settings.use :define
require 'wukong/datatypes'
require 'wukong/periodic_monitor'
require 'wukong/logger'
View
4 lib/wukong/extensions.rb
@@ -2,8 +2,8 @@
# These pull in the minimal functionality of the extlib|activesupport family of
# gems.
#
-require 'wukong/extensions/blank'
-require 'wukong/extensions/class'
+require 'extlib/blank'
+require 'extlib/class'
require 'wukong/extensions/enumerable'
require 'wukong/extensions/symbol'
require 'wukong/extensions/hash'
View
12 lib/wukong/extensions/blank.rb
@@ -15,7 +15,7 @@ class Object
# @api public
def blank?
nil? || (respond_to?(:empty?) && empty?)
- end
+ end unless method_defined?(:blank?)
end # class Object
class Numeric
@@ -31,7 +31,7 @@ class Numeric
# @api public
def blank?
false
- end
+ end unless method_defined?(:blank?)
end # class Numeric
class NilClass
@@ -45,7 +45,7 @@ class NilClass
# @api public
def blank?
true
- end
+ end unless method_defined?(:blank?)
end # class NilClass
class TrueClass
@@ -59,7 +59,7 @@ class TrueClass
# @api public
def blank?
false
- end
+ end unless method_defined?(:blank?)
end # class TrueClass
class FalseClass
@@ -73,7 +73,7 @@ class FalseClass
# @api public
def blank?
true
- end
+ end unless method_defined?(:blank?)
end # class FalseClass
class String
@@ -89,5 +89,5 @@ class String
# @api public
def blank?
strip.empty?
- end
+ end unless method_defined?(:blank?)
end # class String
View
18 lib/wukong/extensions/hash.rb
@@ -66,11 +66,11 @@ def self.zip(keys, values, default=nil, &block)
#
def deep_merge hsh2
merge hsh2, &Hash::DEEP_MERGER
- end
+ end unless method_defined?(:deep_merge)
def deep_merge! hsh2
merge! hsh2, &Hash::DEEP_MERGER
- end
+ end unless method_defined?(:deep_merge!)
#
# Treat hash as tree of hashes:
@@ -86,10 +86,10 @@ def deep_set *args
val = args.pop
last_key = args.pop
# dig down to last subtree (building out if necessary)
- hsh = args.empty? ? self : args.inject(self){|hsh, key| hsh[key] ||= {} }
+ hsh = args.empty? ? self : args.inject(self){|h, k| h[k] ||= {} }
# set leaf value
hsh[last_key] = val
- end
+ end unless method_defined?(:deep_set)
#
# Treat hash as tree of hashes:
@@ -107,10 +107,10 @@ def deep_set *args
def deep_get *args
last_key = args.pop
# dig down to last subtree (building out if necessary)
- hsh = args.inject(self){|hsh, key| hsh[key] || {} }
+ hsh = args.inject(self){|h, k| h[k] || {} }
# get leaf value
hsh[last_key]
- end
+ end unless method_defined?(:deep_get)
#
@@ -126,20 +126,20 @@ def deep_delete *args
last_key = args.pop
last_hsh = args.empty? ? self : (deep_get(*args)||{})
last_hsh.delete(last_key)
- end
+ end unless method_defined?(:deep_delete)
#
# remove all key-value pairs where the value is nil
#
def compact
reject{|key,val| val.nil? }
- end
+ end unless method_defined?(:compact)
#
# Replace the hash with its compacted self
#
def compact!
replace(compact)
- end
+ end unless method_defined?(:compact!)
#
# remove all key-value pairs where the value is blank
View
4 lib/wukong/extensions/hash_like.rb
@@ -64,7 +64,7 @@ def each_pair *args, &block
# Analagous to Hash#merge
#
def merge *args
- self.dup.merge! *args
+ self.dup.merge!(*args)
end
def merge! hsh, &block
raise "can't handle block arg yet" if block
@@ -104,7 +104,7 @@ module ClassMethods
#
def from_hash(hsh, has_symbol_keys=false)
extract_keys = has_symbol_keys ? self.keys.map(&:to_sym) : self.keys.map(&:to_s)
- self.new *hsh.values_of(*extract_keys)
+ self.new(*hsh.values_of(*extract_keys))
end
#
# The last portion of the class in underscored form
View
2  lib/wukong/extensions/symbol.rb
@@ -7,5 +7,5 @@ class Symbol
# <tt>ActiveSupport::CoreExtensions::Symbol</tt>).
def to_proc
Proc.new { |*args| args.shift.__send__(self, *args) }
- end
+ end unless method_defined?(:to_proc)
end
View
2  lib/wukong/logger.rb
@@ -13,7 +13,7 @@ module Wukong
# I, [2009-07-26T19:58:46-05:00 #12332]: Up to 2000 char message
#
def self.logger
- return @logger if @logger
+ return @logger if defined?(@logger)
require 'logger'
@logger = Logger.new STDERR
@logger.instance_eval do
View
1  lib/wukong/script.rb
@@ -1,4 +1,5 @@
require 'pathname'
+require 'wukong/extensions'
require 'configliere' ; Settings.use(:commandline, :env_var, :define)
require 'wukong'
require 'wukong/script/hadoop_command'
View
2  lib/wukong/streamer/base.rb
@@ -103,7 +103,7 @@ def process *args, &block
# Creates a new object of this class and injects the given block
# as the process method
def self.mapper *args, &block
- self.new.mapper *args, &block
+ self.new.mapper(*args, &block)
end
# Delegates back to Wukong to run this instance as a mapper
Please sign in to comment.
Something went wrong with that request. Please try again.