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, graph, query_gsubs = [], column_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, graph, query_gsubs = [], column_gsubs = [])
  @table_name = table_name
  @graph = graph
  @query_gsubs = query_gsubs
  @column_gsubs = column_gsubs
end

Instance Attribute Details

#column_gsubsObject (readonly)

Returns the value of attribute column_gsubs.



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

def column_gsubs
  @column_gsubs
end

#graphObject (readonly)

Returns the value of attribute graph.



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

def graph
  @graph
end

#query_gsubsObject (readonly)

Returns the value of attribute query_gsubs.



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

def query_gsubs
  @query_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
  edges.inject([]) do |memo, edge|
    memo.push(edge_to_query(edge))
    memo
  end
end