active_support.rb 2.9 KB
Newer Older
1
#--
J
Jon Moss 已提交
2
# Copyright (c) 2005-2017 David Heinemeier Hansson
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++

24
require "securerandom"
Y
Yehuda Katz 已提交
25
require "active_support/dependencies/autoload"
26
require "active_support/version"
27
require "active_support/logger"
S
Santiago Pastorino 已提交
28
require "active_support/lazy_load_hooks"
29
require "active_support/core_ext/date_and_time/compatibility"
Y
Yehuda Katz 已提交
30 31 32 33

module ActiveSupport
  extend ActiveSupport::Autoload

34
  autoload :Concern
P
Pan Thomakos 已提交
35
  autoload :Dependencies
36
  autoload :DescendantsTracker
37 38
  autoload :ExecutionWrapper
  autoload :Executor
39
  autoload :FileUpdateChecker
40
  autoload :EventedFileUpdateChecker
41 42
  autoload :LogSubscriber
  autoload :Notifications
43
  autoload :Reloader
44

J
Joshua Peek 已提交
45 46
  eager_autoload do
    autoload :BacktraceCleaner
47
    autoload :ProxyObject
J
Joshua Peek 已提交
48 49 50 51 52 53 54
    autoload :Benchmarkable
    autoload :Cache
    autoload :Callbacks
    autoload :Configurable
    autoload :Deprecation
    autoload :Gzip
    autoload :Inflector
55
    autoload :JSON
56
    autoload :KeyGenerator
J
Joshua Peek 已提交
57 58 59
    autoload :MessageEncryptor
    autoload :MessageVerifier
    autoload :Multibyte
60
    autoload :NumberHelper
J
Joshua Peek 已提交
61 62 63 64
    autoload :OptionMerger
    autoload :OrderedHash
    autoload :OrderedOptions
    autoload :StringInquirer
65
    autoload :TaggedLogging
J
Joshua Peek 已提交
66
    autoload :XmlMini
67
    autoload :ArrayInquirer
J
Joshua Peek 已提交
68
  end
J
Joshua Peek 已提交
69

J
José Valim 已提交
70
  autoload :Rescuable
71
  autoload :SafeBuffer, "active_support/core_ext/string/output_safety"
J
Joshua Peek 已提交
72
  autoload :TestCase
73 74 75 76 77 78

  def self.eager_load!
    super

    NumberHelper.eager_load!
  end
79

80
  cattr_accessor :test_order # :nodoc:
81 82

  def self.halt_callback_chains_on_return_false
83
    Callbacks.halt_and_display_warning_on_return_false
84 85 86
  end

  def self.halt_callback_chains_on_return_false=(value)
87
    Callbacks.halt_and_display_warning_on_return_false = value
88
  end
89 90 91 92 93 94 95 96

  def self.to_time_preserves_timezone
    DateAndTime::Compatibility.preserve_timezone
  end

  def self.to_time_preserves_timezone=(value)
    DateAndTime::Compatibility.preserve_timezone = value
  end
Y
Yehuda Katz 已提交
97
end
98 99

autoload :I18n, "active_support/i18n"