Sha256: c0db6e719a86e596876f21e489a3d27d35d5091b4de021c3bcb4aa05535bcbf6
Contents?: true
Size: 1.23 KB
Versions: 3
Compression:
Stored size: 1.23 KB
Contents
# encoding: utf-8 # Adapted from the rails3 compatibility shim in Haml 2.2 module Formtastic # @private module Util extend self ## Rails XSS Safety # Returns the given text, marked as being HTML-safe. # With older versions of the Rails XSS-safety mechanism, # this destructively modifies the HTML-safety of `text`. # # @param text [String] # @return [String] `text`, marked as HTML-safe def html_safe(text) if text.respond_to?(:html_safe) text.html_safe else text end end def rails3? rails_version >= Gem::Version.new("3.0.0") && rails_version < Gem::Version.new("4.0.0") end def rails4? rails_version >= Gem::Version.new("4.0.0") && rails_version < Gem::Version.new("5.0.0") end def rails4_0? rails_version >= Gem::Version.new("4.0.0") && rails_version < Gem::Version.new("4.1.0") end def rails4_1? rails_version >= Gem::Version.new("4.1.0") && rails_version < Gem::Version.new("4.2.0") end def deprecated_version_of_rails? rails_version < Gem::Version.new("3.2.13") end def rails_version Gem::Version.new(::Rails::VERSION::STRING) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
formtastic-2.3.1 | lib/formtastic/util.rb |
formtastic-2.3.0 | lib/formtastic/util.rb |
formtastic-2.3.0.rc4 | lib/formtastic/util.rb |