Module: Lotion
Instance Method Summary collapse
Instance Method Details
#require(path, caller) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/motion/lotion.rb', line 4 def require(path, caller) return if required.include? path required << path if absolute_path = resolve(path) unless (IGNORED_REQUIRES + REQUIRED).include?(absolute_path) warn [ "Called `require \"#{path}\"` from", derive_caller(caller), "Add within Lotion.setup block: ".yellow + "app.require \"#{path}\"".green ].join("\n") end else raise LoadError, "cannot load such file -- #{path}" end end |
#warn(*args) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/motion/lotion.rb', line 21 def warn(*args) = begin if args.size == 1 args.first else object, method, caller = *args "Called `#{object}.#{method}` from\n#{derive_caller(caller, false)}" end end puts " Warning #{.gsub("\n", "\n ")}".yellow end |