Sha256: f9e01bbcc1a9253d000e6f222768ea4ad6cf0df9d82ea7d76631b679102ea969
Contents?: true
Size: 1.23 KB
Versions: 4
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("4.1.0") end def rails_version Gem::Version.new(::Rails::VERSION::STRING) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
formtastic-3.1.1 | lib/formtastic/util.rb |
formtastic-3.1.0 | lib/formtastic/util.rb |
formtastic-3.1.0.rc2 | lib/formtastic/util.rb |
formtastic-3.1.0.rc1 | lib/formtastic/util.rb |