active_model

  1. #--
  2. # Copyright (c) 2004-2013 David Heinemeier Hansson
  3. #
  4. # Permission is hereby granted, free of charge, to any person obtaining
  5. # a copy of this software and associated documentation files (the
  6. # "Software"), to deal in the Software without restriction, including
  7. # without limitation the rights to use, copy, modify, merge, publish,
  8. # distribute, sublicense, and/or sell copies of the Software, and to
  9. # permit persons to whom the Software is furnished to do so, subject to
  10. # the following conditions:
  11. #
  12. # The above copyright notice and this permission notice shall be
  13. # included in all copies or substantial portions of the Software.
  14. #
  15. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  19. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  20. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  21. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. #++
  23.  
  24. require 'active_support'
  25. require 'active_support/rails'
  26. require 'active_model/version'
  27.  
  28. module ActiveModel
  29. extend ActiveSupport::Autoload
  30.  
  31. autoload :AttributeMethods
  32. autoload :BlockValidator, 'active_model/validator'
  33. autoload :Callbacks
  34. autoload :Conversion
  35. autoload :Dirty
  36. autoload :EachValidator, 'active_model/validator'
  37. autoload :ForbiddenAttributesProtection
  38. autoload :Lint
  39. autoload :Model
  40. autoload :Name, 'active_model/naming'
  41. autoload :Naming
  42. autoload :SecurePassword
  43. autoload :Serialization
  44. autoload :TestCase
  45. autoload :Translation
  46. autoload :Validations
  47. autoload :Validator
  48.  
  49. eager_autoload do
  50. autoload :Errors
  51. end
  52.  
  53. module Serializers
  54. extend ActiveSupport::Autoload
  55.  
  56. eager_autoload do
  57. autoload :JSON
  58. autoload :Xml
  59. end
  60. end
  61.  
  62. def eager_load!
  63. super
  64. ActiveModel::Serializer.eager_load!
  65. end
  66. end
  67.  
  68. ActiveSupport.on_load(:i18n) do
  69. I18n.load_path << File.dirname(__FILE__) + '/active_model/locale/en.yml'
  70. end
Programming language: 
Ruby