module Tabulatr::Utility
Public Class Methods
formatted_name(class_name)
click to toggle source
# File lib/tabulatr/utility/utility.rb, line 47 def self.formatted_name class_name "#{class_name.gsub(/::/, '--').downcase}" end
like_statement()
click to toggle source
# File lib/tabulatr/utility/utility.rb, line 25 def self.like_statement case ActiveRecord::Base.connection.class.to_s when "ActiveRecord::ConnectionAdapters::MysqlAdapter", "ActiveRecord::ConnectionAdapters::Mysql2Adapter", "ActiveRecord::ConnectionAdapters::SQLiteAdapter", "ActiveRecord::ConnectionAdapters::SQLite3Adapter" then 'LIKE' when "ActiveRecord::ConnectionAdapters::PostgreSQLAdapter" then 'ILIKE' else warn("Tabulatr Warning: Don't know which LIKE operator to use for the ConnectionAdapter '#{ActiveRecord::Base.connection.class}'.\n") 'LIKE' end end
string_to_boolean(str)
click to toggle source
# File lib/tabulatr/utility/utility.rb, line 39 def self.string_to_boolean str if str.downcase == 'true' true elsif str.downcase == 'false' false end end