class Udongo::ObjectPath

Public Class Methods

cleanup(value) click to toggle source
# File lib/udongo/object_path.rb, line 17
def self.cleanup(value)
  value.to_s.gsub('_decorator', '')
end
find(object) click to toggle source
# File lib/udongo/object_path.rb, line 2
def self.find(object)
  unless object.is_a?(Array)
    return cleanup("#{object.class.name.underscore}_path")
  end

  object.map do |item|
    item.is_a?(Symbol) ? "#{item}" : cleanup(item.class.name.underscore)
  end.join('_') << '_path'
end
remove_symbols(object) click to toggle source
# File lib/udongo/object_path.rb, line 12
def self.remove_symbols(object)
  return object unless object.is_a?(Array)
  object.select { |o| !o.is_a?(Symbol) }
end