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.



244
245
246
247
248
249
250
251
252
# File 'lib/prick/builder/node.rb', line 244

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.



236
237
238
# File 'lib/prick/builder/node.rb', line 236

def decl_nodes
  @decl_nodes
end

#has_schemaObject

True if the build file contains a ‘schema’ attribute



232
233
234
# File 'lib/prick/builder/node.rb', line 232

def has_schema
  @has_schema
end

#init_nodesObject (readonly)

Returns the value of attribute init_nodes.



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

def init_nodes
  @init_nodes
end

#pg_graph_ignore_schemaObject

Returns the value of attribute pg_graph_ignore_schema.



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

def pg_graph_ignore_schema
  @pg_graph_ignore_schema
end

#refresh_schemaObject

Returns the value of attribute refresh_schema.



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

def refresh_schema
  @refresh_schema
end

#seed_nodesObject (readonly)

Returns the value of attribute seed_nodes.



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

def seed_nodes
  @seed_nodes
end

#term_nodesObject (readonly)

Returns the value of attribute term_nodes.



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

def term_nodes
  @term_nodes
end

Instance Method Details

#dumpObject



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/prick/builder/node.rb', line 256

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



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

def inspect() to_s end

#nodesObject



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

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