Class: Cmap::GraphToSql

Inherits:
Object
  • Object
show all
Defined in:
lib/cmap/graph_to_sql.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_name, schema_name, graph, subquery_gsubs = []) ⇒ GraphToSql

Returns a new instance of GraphToSql.



5
6
7
8
9
10
# File 'lib/cmap/graph_to_sql.rb', line 5

def initialize(table_name, schema_name, graph, subquery_gsubs = [])
  @table_name = table_name
  @schema_name = schema_name
  @graph = graph
  @subquery_gsubs = subquery_gsubs
end

Instance Attribute Details

#graphObject (readonly)

Returns the value of attribute graph.



3
4
5
# File 'lib/cmap/graph_to_sql.rb', line 3

def graph
  @graph
end

#schema_nameObject (readonly)

Returns the value of attribute schema_name.



3
4
5
# File 'lib/cmap/graph_to_sql.rb', line 3

def schema_name
  @schema_name
end

#subquery_gsubsObject (readonly)

Returns the value of attribute subquery_gsubs.



3
4
5
# File 'lib/cmap/graph_to_sql.rb', line 3

def subquery_gsubs
  @subquery_gsubs
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



3
4
5
# File 'lib/cmap/graph_to_sql.rb', line 3

def table_name
  @table_name
end

Instance Method Details

#queriesObject



12
13
14
15
16
17
# File 'lib/cmap/graph_to_sql.rb', line 12

def queries
  sorted_grouped_edges.inject([]) do |memo, (_, edges)|
    memo += (EdgesToQueries.new(edges, table_name, schema_name, subquery_expander).queries)
    memo
  end
end