class RRSE::Database
Public Class Methods
new(dir, separator)
click to toggle source
# File lib/rrse/database.rb, line 4 def initialize(dir, separator) @table = File.open(dir.join("table")){|f| MessagePack.load(f)} @index_table = File.open(dir.join("index_table")){|f| MessagePack.load(f)} @separator = separator end
Public Instance Methods
instance_method_name?(spec)
click to toggle source
# File lib/rrse/database.rb, line 18 def instance_method_name?(spec) return false unless /([.:#])[^.:#]+\Z/.match(spec) return $1 == "#" end
query_full_name(name)
click to toggle source
# File lib/rrse/database.rb, line 23 def query_full_name(name) @table.fetch(name, []).map{|param| "#{name}#{param}"}.join(@separator) end
query_instance_method(query)
click to toggle source
# File lib/rrse/database.rb, line 10 def query_instance_method(query) @index_table.fetch(query, []).find_all{|spec| instance_method_name?(spec) }.map{|spec| query_full_name(spec) }.join(@separator) end
query_toplevel_method(query)
click to toggle source
# File lib/rrse/database.rb, line 27 def query_toplevel_method(query) @index_table.fetch(query, []).find_all{|spec| toplevel_name?(spec) }.map{|spec| query_full_name(spec) }.join(@separator) end
toplevel_name?(spec)
click to toggle source
# File lib/rrse/database.rb, line 35 def toplevel_name?(spec) /\A(Object\#|Kernel\.|Module#)(?!(initialize|class))/ =~ spec end