lib/egi/env.rb in egi-0.0.3 vs lib/egi/env.rb in egi-0.0.4
- old
+ new
@@ -24,7 +24,20 @@
end
def item(name, hash = {})
items[name.to_sym].update(hash)
end
+
+ def [](name)
+ items[name.to_sym]
+ end
+
+ def tags
+ @tags ||= items.values.map {|item| item[:tags] || [] }.flatten.uniq
+ end
+
+ def tagged(name)
+ name = name.to_sym
+ tags.include?(name) ? items.select {|k, v| v[:tags].include?(name) } : nil
+ end
end
end