Class: StreamBot::ArrayPath
- Inherits:
-
Object
- Object
- StreamBot::ArrayPath
- Defined in:
- lib/streambot/array_path.rb
Overview
ArrayPath like XPath, but for Arrays
Class Method Summary collapse
Class Method Details
.get_path(object, path) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/streambot/array_path.rb', line 5 def self.get_path(object, path) # raise "#{object} is not an array" if !object.is_a?(Array) segments = path.chomp.split("/") segments.each do |segment| object = object[segment] end object end |