class RRSE::Command::UpdateDB::BitClustAdaptor

Public Class Methods

new(bitclust_config, version, dbpath) click to toggle source
# File lib/rrse/update-db-command.rb, line 56
def initialize(bitclust_config, version, dbpath)
  version ||= bitclust_config[:default_version]
  dbpath ||= bitclust_config[:database_prefix] + "-" + version
  @db = BitClust::MethodDatabase.new(dbpath)
end

Public Instance Methods

extract_params_from_source(name, source) click to toggle source
# File lib/rrse/update-db-command.rb, line 87
def extract_params_from_source(name, source)
  source.each_line.find_all{|line|
    /\A--- #{Regexp.quote(name)}[^a-zA-Z_\[\]=]/ =~ line
  }.map{|line|
    line.chomp.
      gsub(/\A--- #{Regexp.quote(name)}/, "").
      gsub(/\t/, "").
      gsub(/ +/, "").
      gsub(/->nil\Z/, "").
      gsub(/->\(\)\Z/, "")
  }
end
generate_tables() click to toggle source
# File lib/rrse/update-db-command.rb, line 62
def generate_tables
  all_entries = Hash.new{|h, k| h[k] = [] }
  index_table = Hash.new{|h, k| h[k] = [] }
  @db.classes.each do |c|
    c.entries.each do |m|
      typemark = normalize_typemark(m.typemark)
      next unless method_typemark?(typemark)
      m.names.each do |name|
        spec = "#{c.name}#{typemark}#{name}"
        all_entries[spec].concat(extract_params_from_source(name, m.source))
        index_table[name] << spec
      end
    end
  end
  return all_entries, index_table
end
method_typemark?(typemark) click to toggle source
# File lib/rrse/update-db-command.rb, line 83
def method_typemark?(typemark)
  typemark == "." || typemark == "#"
end
normalize_typemark(typemark) click to toggle source
# File lib/rrse/update-db-command.rb, line 79
def normalize_typemark(typemark)
  typemark == ".#" ? "." : typemark
end