Module: GoodData::Bam::Graph

Defined in:
lib/base/graph.rb

Class Method Summary collapse

Class Method Details

.create(graph) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/base/graph.rb', line 5

def self.create(graph)
  fail "Graph should have graph to execute. You defined \"#{graph}\"" if graph[:path].blank?
  if(!URI.parse(graph[:path].to_s).absolute?)
    # it is a path
    {
      :inputs => [],
      :outputs => []
    }.merge(graph).merge({
      :path => Pathname(graph[:path]),
      :name => Pathname(graph[:path]).basename.to_s,
      :type => :graph
    })
  else
    # it is a URI
    {
      :inputs => [],
      :outputs => []
    }.merge(graph).merge({
      :path => URI(graph[:path]),
      :name => URI(graph[:path]),
      :type => :graph
    })
  end
end

.get_path(graph) ⇒ Object



30
31
32
# File 'lib/base/graph.rb', line 30

def self.get_path(graph)
  Pathname(graph[:repository][:base]) + graph[:path]
end