lib/depth/route_element.rb in depth-0.0.1 vs lib/depth/route_element.rb in depth-0.0.2
- old
+ new
@@ -20,12 +20,12 @@
def convert(el)
return el if el.is_a?(RouteElement)
case el
when Array
type = el.count > 1 ? el[1] : :hash
- RouteElement.new(route_el[0], type: type)
+ RouteElement.new(el[0], type: type)
when Hash
- key_or_index = el.fetch(:key, el.fetch(:index))
+ key_or_index = el.fetch(:key) { el.fetch(:index) }
RouteElement.new(key_or_index, type: el.fetch(:type, :hash))
else
RouteElement.new(el)
end
end