Class: Prick::Build::BuildNode

Inherits:
Node
  • Object
show all
Defined in:
lib/prick/builder/node.rb

Overview

A build.yml file node

Direct Known Subclasses

RootBuildNode

Instance Attribute Summary collapse

Attributes inherited from Node

#args, #kind, #parent, #path, #phase

Instance Method Summary collapse

Methods inherited from Node

#lines, #name, #prefix_lines, #relpath, #schema, #schema=, #source, #source_lines, #to_s

Constructor Details

#initialize(parent, path) ⇒ BuildNode

Returns a new instance of BuildNode.



250
251
252
253
254
255
256
257
258
# File 'lib/prick/builder/node.rb', line 250

def initialize(parent, path)
  super(parent, nil, :yml, path)
  @decl_nodes = []
  @init_nodes = []
  @term_nodes = []
  @seed_nodes = []
  @pg_graph_ignore_schema = false
  @refresh_schema = true
end

Instance Attribute Details

#decl_nodesObject (readonly)

Returns the value of attribute decl_nodes.



242
243
244
# File 'lib/prick/builder/node.rb', line 242

def decl_nodes
  @decl_nodes
end

#has_schemaObject

True if the build file contains a ‘schema’ attribute



238
239
240
# File 'lib/prick/builder/node.rb', line 238

def has_schema
  @has_schema
end

#init_nodesObject (readonly)

Returns the value of attribute init_nodes.



243
244
245
# File 'lib/prick/builder/node.rb', line 243

def init_nodes
  @init_nodes
end

#pg_graph_ignore_schemaObject

Returns the value of attribute pg_graph_ignore_schema.



247
248
249
# File 'lib/prick/builder/node.rb', line 247

def pg_graph_ignore_schema
  @pg_graph_ignore_schema
end

#refresh_schemaObject

Returns the value of attribute refresh_schema.



248
249
250
# File 'lib/prick/builder/node.rb', line 248

def refresh_schema
  @refresh_schema
end

#seed_nodesObject (readonly)

Returns the value of attribute seed_nodes.



245
246
247
# File 'lib/prick/builder/node.rb', line 245

def seed_nodes
  @seed_nodes
end

#term_nodesObject (readonly)

Returns the value of attribute term_nodes.



244
245
246
# File 'lib/prick/builder/node.rb', line 244

def term_nodes
  @term_nodes
end

Instance Method Details

#dumpObject



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/prick/builder/node.rb', line 262

def dump
  puts "BuildNode #{path}"
  indent {
    puts "has_schema: #{has_schema}"
    puts "schema: #{@schema || 'nil'}"
    puts "refresh: #{refresh_schema.to_s}"
    puts "pg_graph_ignore_schema: #{pg_graph_ignore_schema}"
    decl_nodes.each(&:dump)
    for kind in [:init, :term, :seed]
      kind_nodes = self.send("#{kind}_nodes".to_sym)
      if !kind_nodes.empty?
        puts "#{kind}:"
        indent { kind_nodes.each(&:dump) }
      end
    end
  }
end

#inspectObject



260
# File 'lib/prick/builder/node.rb', line 260

def inspect() to_s end

#nodesObject



240
# File 'lib/prick/builder/node.rb', line 240

def nodes() @nodes ||= init_nodes + decl_nodes + seed_nodes + term_nodes end