class Alki::Execution::TagMap
Public Class Methods
new(tag_map = {})
click to toggle source
# File lib/alki/execution/tag_map.rb, line 4 def initialize(tag_map = {}) @tag_map = tag_map end
Public Instance Methods
add(path,tags)
click to toggle source
# File lib/alki/execution/tag_map.rb, line 8 def add(path,tags) tags.each do |tag,value| @tag_map[tag] ||= {} @tag_map[tag][path] = value end end
elements_in(tag)
click to toggle source
# File lib/alki/execution/tag_map.rb, line 15 def elements_in(tag) (@tag_map[tag] && @tag_map[tag].keys) || [] end
index(key)
click to toggle source
# File lib/alki/execution/tag_map.rb, line 19 def index(key) new_tag_map = {} @tag_map.each do |tag,tagged| tagged.each do |path,value| if path.empty? || path[0] == key.to_sym new_tag_map[tag] ||= {} new_path = path[1..-1] || [] new_tag_map[tag][new_path] = value end end end self.class.new new_tag_map end