module Rudash::Utils

Public Class Methods

force_reverse(collection) click to toggle source
# File lib/utils/index.rb, line 15
def self.force_reverse(collection)
  case collection
  when Array then collection.reverse
  when Hash then collection.reverse_each.to_h
  when String then collection.reverse
  else []
  end
end
function?(func) click to toggle source
# File lib/utils/index.rb, line 11
def self.function?(func)
  func.is_a?(Proc) || func.is_a?(Method)
end
match_number?(str) click to toggle source
# File lib/utils/index.rb, line 5
def self.match_number?(str)
  return false unless str.is_a?(String)

  str.match(/^(\d)+$/)
end