module Formtastic::Util
@private
Public Instance Methods
deprecated_version_of_rails?()
click to toggle source
# File lib/formtastic/util.rb, line 40 def deprecated_version_of_rails? match?(rails_version, "< #{minimum_version_of_rails}") end
html_safe(text)
click to toggle source
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
# File lib/formtastic/util.rb, line 16 def html_safe(text) if text.respond_to?(:html_safe) text.html_safe else text end end
match?(version, dependency)
click to toggle source
# File lib/formtastic/util.rb, line 52 def match?(version, dependency) Gem::Dependency.new("formtastic", dependency).match?("formtastic", version) end
minimum_version_of_rails()
click to toggle source
# File lib/formtastic/util.rb, line 44 def minimum_version_of_rails "4.1.0" end
rails3?()
click to toggle source
# File lib/formtastic/util.rb, line 24 def rails3? match?(rails_version, "~> 3.0") end
rails4?()
click to toggle source
# File lib/formtastic/util.rb, line 28 def rails4? match?(rails_version, "~> 4.0") end
rails4_0?()
click to toggle source
# File lib/formtastic/util.rb, line 32 def rails4_0? match?(rails_version, "~> 4.0.0") end
rails4_1?()
click to toggle source
# File lib/formtastic/util.rb, line 36 def rails4_1? match?(rails_version, "~> 4.1.0") end
rails_version()
click to toggle source
# File lib/formtastic/util.rb, line 48 def rails_version ::Rails::VERSION::STRING end