From ec48e2647f918062eaed8d64f62fb3acbddce4fd Mon Sep 17 00:00:00 2001 From: Wade Alcorn Date: Tue, 21 Feb 2012 06:08:15 +1000 Subject: [PATCH] Minor update to trigger test server --- core/ruby/hash.rb | 30 +++++++++++++++--------------- core/ruby/module.rb | 6 +++--- core/ruby/object.rb | 14 +++++++------- core/ruby/print.rb | 14 +++++++------- core/ruby/string.rb | 2 +- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/core/ruby/hash.rb b/core/ruby/hash.rb index 5ea4e4e67..1ee46bec0 100644 --- a/core/ruby/hash.rb +++ b/core/ruby/hash.rb @@ -15,20 +15,20 @@ # class Hash - # Recursively deep merge two hashes together - # @param [Hash] hash Hash to be merged - # @return [Hash] Combined hash - # @note Duplicate keys are overwritten by the value defined in the hash calling deep_merge (not the parameter hash) - # @note http://snippets.dzone.com/posts/show/4706 - def deep_merge(hash) - target = dup - hash.keys.each do |key| - if hash[key].is_a? Hash and self[key].is_a? Hash - target[key] = target[key].deep_merge(hash[key]) - next - end - target[key] = hash[key] - end - target + # Recursively deep merge two hashes together + # @param [Hash] hash Hash to be merged + # @return [Hash] Combined hash + # @note Duplicate keys are overwritten by the value defined in the hash calling deep_merge (not the parameter hash) + # @note http://snippets.dzone.com/posts/show/4706 + def deep_merge(hash) + target = dup + hash.keys.each do |key| + if hash[key].is_a? Hash and self[key].is_a? Hash + target[key] = target[key].deep_merge(hash[key]) + next + end + target[key] = hash[key] end + target + end end diff --git a/core/ruby/module.rb b/core/ruby/module.rb index d7e0ae3b7..7fa3d53d4 100644 --- a/core/ruby/module.rb +++ b/core/ruby/module.rb @@ -21,7 +21,7 @@ class Module classes = [] ObjectSpace.each_object(Class) { |k| classes << k if k.included_modules.include?(self) } - classes.reverse.inject([]) do |unique_classes, klass| + classes.reverse.inject([]) do |unique_classes, klass| unique_classes << klass unless unique_classes.collect { |k| k.to_s }.include?(klass.to_s) unique_classes end @@ -32,8 +32,8 @@ class Module def included_in_modules modules = [] ObjectSpace.each_object(Module) { |k| modules << k if k.included_modules.include?(self) } - - modules.reverse.inject([]) do |unique_modules, klass| + + modules.reverse.inject([]) do |unique_modules, klass| unique_modules << klass unless unique_modules.collect { |k| k.to_s }.include?(klass.to_s) unique_modules end diff --git a/core/ruby/object.rb b/core/ruby/object.rb index f51a611d5..da57bcfd9 100644 --- a/core/ruby/object.rb +++ b/core/ruby/object.rb @@ -14,35 +14,35 @@ # limitations under the License. # class Object - + # Returns true if the object is a Boolean # @return [Boolean] Whether the object is boolean def boolean? - self.is_a?(TrueClass) || self.is_a?(FalseClass) + self.is_a?(TrueClass) || self.is_a?(FalseClass) end - + # Returns true if the object is a String # @return [Boolean] Whether the object is a string def string? self.is_a?(String) end - + # Returns true if the object is an Integer # @return [Boolean] Whether the object is an integer def integer? self.is_a?(Integer) end - + # Returns true if the object is a hash # @return [Boolean] Whether the object is a hash def hash? self.is_a?(Hash) end - + # Returns true if the object is a class # @return [Boolean] Whether the object is a class def class? self.is_a?(Class) end - + end diff --git a/core/ruby/print.rb b/core/ruby/print.rb index bfd52e6fe..ae066a5db 100644 --- a/core/ruby/print.rb +++ b/core/ruby/print.rb @@ -31,10 +31,10 @@ end # @note This function will only print messages if the debug flag is set to true # @todo Once the console extension has been merged into the core, remove the extension checks. def print_debug(s) - config = BeEF::Core::Configuration.instance - if config.get('beef.debug') || (BeEF::Extension.is_loaded('console') && BeEF::Extension::Console.verbose?) - puts Time.now.localtime.strftime("[%k:%M:%S]")+'[>]'.yellow+' '+s.to_s - end + config = BeEF::Core::Configuration.instance + if config.get('beef.debug') || (BeEF::Extension.is_loaded('console') && BeEF::Extension::Console.verbose?) + puts Time.now.localtime.strftime("[%k:%M:%S]")+'[>]'.yellow+' '+s.to_s + end end # Function used to print successes to the console @@ -49,14 +49,14 @@ end def print_more(s) time = Time.now.localtime.strftime("[%k:%M:%S]") lines = s.split("\n") - - lines.each_with_index do |line, index| + + lines.each_with_index do |line, index| if ((index+1) == lines.size) puts "#{time} |_ #{line}" else puts "#{time} | #{line}" end - end + end end # Function used to print over the current line diff --git a/core/ruby/string.rb b/core/ruby/string.rb index fe28e9af4..9f825ebab 100644 --- a/core/ruby/string.rb +++ b/core/ruby/string.rb @@ -18,5 +18,5 @@ class String # @note Use a gem to colorize the console. # @note http://flori.github.com/term-ansicolor/ include Term::ANSIColor - + end