class Pero::History
Public Class Methods
search(query, dir="nodes")
click to toggle source
# File lib/pero/history.rb, line 5 def self.search(query, dir="nodes") ret = [] Dir.foreach(dir) do |f| next if %w(. ..).include? f next unless f =~ /json$/ File.open(File.join(dir, f)) do |j| h = JSON.load(j) ret << h if h["name"] =~ /#{query}/ end end ret end