Sha256: 3df07be89b6a609a6571c51626d94f4ce9b0142d6231a81eca917c1f86e08407
Contents?: true
Size: 798 Bytes
Versions: 49
Compression:
Stored size: 798 Bytes
Contents
class String def trackman_underscore word = dup word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2') word.gsub!(/([a-z\d])([A-Z])/,'\1_\2') word.tr!("-", "_") word.downcase! word end end class Symbol def trackman_underscore to_s.trackman_underscore end end module Trackman module Assets #TODO do something better than this to share the scope def self.autoloads path, items items.each do |s| if block_given? yield(s, "#{path}/#{s.trackman_underscore}" ) else autoload s, "#{path}/#{s.trackman_underscore}" end end end @@classes = [:Asset, :HtmlAsset, :RemoteAsset, :CssAsset] @@modules = [:Components, :Errors] autoloads 'trackman/assets', @@classes.concat(@@modules) end end
Version data entries
49 entries across 49 versions & 1 rubygems