lib/oboe/util.rb in oboe-2.6.2.0 vs lib/oboe/util.rb in oboe-2.6.3.0

- old
+ new

@@ -3,11 +3,11 @@ module Oboe module Util class << self ## - # oboe_alias + # method_alias # # Centralized utility method to alias a method on an arbitrary # class or module. # def method_alias(cls, method, name=nil) @@ -43,18 +43,45 @@ else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument #{name}. Partial traces may occur." end end ## - # oboe_send_include + # send_include # # Centralized utility method to send a include call for an # arbitrary class def send_include(target_cls, cls) if defined?(target_cls) target_cls.send(:include, cls) end end + + ## + # static_asset? + # + # Given a path, this method determines whether it is a static asset or not (based + # solely on filename) + # + def static_asset?(path) + return (path =~ /\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|ttf|woff|svg|less)$/i) + end + + ## + # prettify + # + # Even to my surprise, 'prettify' is a real word: + # transitive v. To make pretty or prettier, especially in a superficial or insubstantial way. + # from The American Heritage® Dictionary of the English Language, 4th Edition + # + # This method makes things 'purty' for reporting. + def prettify(x) + if (x.to_s =~ /^#</) == 0 + x.class.to_s + else + x.to_s + end + end + end end end