Class: Qrpm::HashNode

Inherits:
ContainerNode show all
Defined in:
lib/qrpm/node.rb

Overview

A HashNode has a hash as expr. It doesn’t forward #interpolate to its members (FileNode overrides that)

Direct Known Subclasses

FileNode, RootNode

Instance Attribute Summary

Attributes inherited from Node

#expr, #name, #parent, #path

Instance Method Summary collapse

Methods inherited from ContainerNode

#signature, #values, #variables

Methods inherited from Node

#class_name, #dot, #inspect, #interpolate, #interpolated?, #signature, #traverse, #variables

Constructor Details

#initialize(parent, name, hash = {}) ⇒ HashNode

Returns a new instance of HashNode.



188
189
190
191
# File 'lib/qrpm/node.rb', line 188

def initialize(parent, name, hash = {}) 
  constrain hash, Hash
  super(parent, name, hash.dup)
end

Instance Method Details

#dumpObject



195
196
197
198
199
200
201
202
203
204
# File 'lib/qrpm/node.rb', line 195

def dump
  puts "{"
  indent {
    expr.each { |k,v| 
      print "#{k}: "
      v.dump
    }
  }
  puts "}"
end

#exprsObject

Override ContainerNode#exprs



186
# File 'lib/qrpm/node.rb', line 186

def exprs() expr.values end