Class: Prick::Build::BuildNode

Inherits:
Node
  • Object
show all
Defined in:
lib/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, #source

Instance Method Summary collapse

Methods inherited from Node

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

Constructor Details

#initialize(parent, path) ⇒ BuildNode

Returns a new instance of BuildNode.



171
172
173
174
175
176
177
178
179
# File 'lib/builder/node.rb', line 171

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.



163
164
165
# File 'lib/builder/node.rb', line 163

def decl_nodes
  @decl_nodes
end

#init_nodesObject (readonly)

Returns the value of attribute init_nodes.



164
165
166
# File 'lib/builder/node.rb', line 164

def init_nodes
  @init_nodes
end

#pg_graph_ignore_schemaObject

Returns the value of attribute pg_graph_ignore_schema.



168
169
170
# File 'lib/builder/node.rb', line 168

def pg_graph_ignore_schema
  @pg_graph_ignore_schema
end

#refresh_schemaObject

Returns the value of attribute refresh_schema.



169
170
171
# File 'lib/builder/node.rb', line 169

def refresh_schema
  @refresh_schema
end

#seed_nodesObject (readonly)

Returns the value of attribute seed_nodes.



166
167
168
# File 'lib/builder/node.rb', line 166

def seed_nodes
  @seed_nodes
end

#term_nodesObject (readonly)

Returns the value of attribute term_nodes.



165
166
167
# File 'lib/builder/node.rb', line 165

def term_nodes
  @term_nodes
end

Instance Method Details

#dumpObject



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/builder/node.rb', line 183

def dump
  puts "BuildNode #{path}"
  indent {
    puts "schema: #{schema}" if schema
    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.upcase}:"
        indent { kind_nodes.each(&:dump) } 
      end
    end
  }
end

#inspectObject



181
# File 'lib/builder/node.rb', line 181

def inspect() to_s end

#nodesObject



161
# File 'lib/builder/node.rb', line 161

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