module Formtastic::Util
@private
Public Instance Methods
deprecated_version_of_rails?()
click to toggle source
# File lib/formtastic/util.rb, line 39 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 15 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 51 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 43 def minimum_version_of_rails "4.1.0" end
rails3?()
click to toggle source
# File lib/formtastic/util.rb, line 23 def rails3? match?(rails_version, "~> 3.0") end
rails4?()
click to toggle source
# File lib/formtastic/util.rb, line 27 def rails4? match?(rails_version, "~> 4.0") end
rails4_0?()
click to toggle source
# File lib/formtastic/util.rb, line 31 def rails4_0? match?(rails_version, "~> 4.0.0") end
rails4_1?()
click to toggle source
# File lib/formtastic/util.rb, line 35 def rails4_1? match?(rails_version, "~> 4.1.0") end
rails_version()
click to toggle source
# File lib/formtastic/util.rb, line 47 def rails_version ::Rails::VERSION::STRING end