Sha256: cb8701a41114d1ccc46614e4853d2cd97a1753946757eccea5e690b613aa40bf
Contents?: true
Size: 613 Bytes
Versions: 1
Compression:
Stored size: 613 Bytes
Contents
class Udongo::ObjectPath # TODO it would be better if this always expects an array, that way this could # be rewritten a lot cleaner. 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 def self.remove_symbols(object) return object unless object.is_a?(Array) object.select { |o| !o.is_a?(Symbol) } end private def self.cleanup(value) value.to_s.gsub('_decorator', '') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
udongo-0.1.0 | lib/udongo/object_path.rb |