module SimpleValidate::Utils

Public Class Methods

article(input) click to toggle source
# File lib/simple_validate/utils.rb, line 9
def self.article(input)
  vowels = %w[a e i o u]
  vowels.include?(input[0]) ? "an" : "a"
end
camelize(input) click to toggle source
# File lib/simple_validate/utils.rb, line 5
  def self.camelize(input) = input.to_s.split("_").map(&:capitalize).join
  def self.extract_options!(args) = args.last.is_a?(Hash) ? args.pop : {}
  def self.classify(input) = Object.const_get(camelize(input))

  def self.article(input)
    vowels = %w[a e i o u]
    vowels.include?(input[0]) ? "an" : "a"
  end
end
classify(input) click to toggle source
# File lib/simple_validate/utils.rb, line 7
  def self.classify(input) = Object.const_get(camelize(input))

  def self.article(input)
    vowels = %w[a e i o u]
    vowels.include?(input[0]) ? "an" : "a"
  end
end
extract_options!(args) click to toggle source
# File lib/simple_validate/utils.rb, line 6
    def self.extract_options!(args) = args.last.is_a?(Hash) ? args.pop : {}
    def self.classify(input) = Object.const_get(camelize(input))

    def self.article(input)
      vowels = %w[a e i o u]
      vowels.include?(input[0]) ? "an" : "a"
    end
  end
end