class RomSqlGraph::Base

Attributes

repo[R]

Public Class Methods

new(repo) click to toggle source
# File lib/rom_sql_graph/base.rb, line 8
def initialize(repo)
  @repo = repo
end

Public Instance Methods

edges() click to toggle source
# File lib/rom_sql_graph/base.rb, line 12
def edges
  Edges.new(repo).to_a
end
Also aliased as: to_a
generate_html() click to toggle source
# File lib/rom_sql_graph/base.rb, line 21
def generate_html
  HtmlGeneration.new(edges).call
end
generate_image() click to toggle source
# File lib/rom_sql_graph/base.rb, line 17
def generate_image
  graph.write_to_graphic_file('jpg')
end
to_a()
Alias for: edges
to_s() click to toggle source
# File lib/rom_sql_graph/base.rb, line 25
def to_s
  graph.edges.sort.to_s
end

Private Instance Methods

graph() click to toggle source
# File lib/rom_sql_graph/base.rb, line 31
def graph
  if @graph.nil?
    @graph ||= RGL::DirectedAdjacencyGraph[]
    to_a.each { |edge| graph.add_edge(*edge) }
  end

  @graph
end