Module: Cowtech::Extensions
- Defined in:
- lib/cowtech-extensions.rb,
lib/cowtech-extensions/hash.rb,
lib/cowtech-extensions/math.rb,
lib/cowtech-extensions/utils.rb,
lib/cowtech-extensions/string.rb,
lib/cowtech-extensions/boolean.rb,
lib/cowtech-extensions/version.rb,
lib/cowtech-extensions/datetime.rb,
lib/cowtech-extensions/pathname.rb
Defined Under Namespace
Modules: Boolean, DateTime, Exceptions, Hash, Math, Pathname, String, Version
Class Method Summary collapse
Class Method Details
.load!(what = []) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/cowtech-extensions.rb', line 17 def self.load!(what = []) what = ["object", "boolean", "string", "hash", "datetime", "math", "pathname"] if what.count == 0 what.collect! { |w| w.to_s } yield if block_given? if what.include?("object") then ::Object.class_eval do include Cowtech::Extensions::Object end end if what.include?("boolean") then ::TrueClass.class_eval do include Cowtech::Extensions::Object include Cowtech::Extensions::Boolean end ::FalseClass.class_eval do include Cowtech::Extensions::Object include Cowtech::Extensions::Boolean end end if what.include?("string") then ::String.class_eval do include Cowtech::Extensions::String end end if what.include?("hash") then ::Hash.class_eval do include Cowtech::Extensions::Hash end end if what.include?("datetime") then ::Time.class_eval do include Cowtech::Extensions::DateTime end ::Date.class_eval do include Cowtech::Extensions::DateTime end ::DateTime.class_eval do include Cowtech::Extensions::DateTime end ::Date.setup_localization ::Time.setup_localization ::DateTime.setup_localization end if what.include?("math") then ::Math.class_eval do include Cowtech::Extensions::Math end end if what.include?("pathname") then require "pathname" ::Pathname.class_eval do include Cowtech::Extensions::Pathname end end end |