lib/gravatarify.rb in gravatarify-2.1.0 vs lib/gravatarify.rb in gravatarify-2.2.1
- old
+ new
@@ -1,12 +1,17 @@
-# Loads all required submodules
+require 'gravatarify/base'
+require 'gravatarify/utils'
+require 'gravatarify/helper'
+
module Gravatarify
# current API version, as defined by http://semver.org/
- VERSION = "2.1.0".freeze
-
- autoload :Base, 'gravatarify/base'
- autoload :Utils, 'gravatarify/utils'
- autoload :Helper, 'gravatarify/helper'
+ VERSION = "2.2.1".freeze
end
-# and add HAML support (if defined)
-Haml::Helpers.send(:include, Gravatarify::Helper) if defined?(Haml)
+if defined?(ActiveSupport) && ActiveSupport.respond_to?(:on_load)
+ # Support for rails 3
+ ActiveSupport.on_load(:action_view) { include Gravatarify::Helper }
+else
+ # try to hook into HAML and ActionView
+ Haml::Helpers.send(:include, Gravatarify::Helper) if defined?(Haml)
+ ActionView::Base.send(:include, Gravatarify::Helper) if defined?(ActionView)
+end