module Ecoportal::API::Common::Content::ModelHelpers
Private Instance Methods
hash_except(hash, *keys)
click to toggle source
# File lib/ecoportal/api/common/content/model_helpers.rb, line 27 def hash_except(hash, *keys) keys.each {|key| hash.delete(key)} hash end
same_string?(value1, value2, exact: false)
click to toggle source
Offers multiple ways to compare two strings
# File lib/ecoportal/api/common/content/model_helpers.rb, line 10 def same_string?(value1, value2, exact: false) case when value1.is_a?(String) && value2.is_a?(String) if exact value1 == value2 else value1.to_s.strip.downcase == value2.to_s.strip.downcase end when value1.is_a?(Regexp) && value2.is_a?(String) value2 =~ value1 when value1.is_a?(String) && value2.is_a?(Regexp) value1 =~ value2 else value1 == value2 end end