class Device::Support

Public Class Methods

camelize(str) click to toggle source
# File lib/device/support.rb, line 11
def self.camelize(str)
  str.split('_').map {|w| w.capitalize}.join
end
class_to_path(klass) click to toggle source
# File lib/device/support.rb, line 3
def self.class_to_path(klass)
  klass.to_s.downcase
end
constantize(name) click to toggle source
# File lib/device/support.rb, line 19
def self.constantize(name)
  if ! name.empty? && Object.const_defined?(name)
    Object.const_get name
  else
    nil
  end
end
path_to_class(path) click to toggle source
# File lib/device/support.rb, line 7
def self.path_to_class(path)
  constantize(camelize(remove_extension(path)))
end
remove_extension(path) click to toggle source
# File lib/device/support.rb, line 15
def self.remove_extension(path)
  path.to_s.split(".")[-2].split("/").last
end