Class: Prick::Build::ModuleNode
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Attributes inherited from Node
#args, #kind, #parent, #path, #phase, #source
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(parent, phase, path, klass, command, args = nil) ⇒ ModuleNode
constructor
A new instance of ModuleNode.
- #inspect ⇒ Object
- #object ⇒ Object
Methods inherited from Node
#dump, #lines, #name, #prefix_lines, #schema, #schema=, #source_lines, #to_s
Constructor Details
#initialize(parent, phase, path, klass, command, args = nil) ⇒ ModuleNode
Returns a new instance of ModuleNode.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/builder/node.rb', line 96 def initialize(parent, phase, path, klass, command, args = nil) constrain klass, Symbol, String constrain command, Symbol, String super(parent, phase, :module, path, args) @klass = klass.to_sym @command = command.to_sym if !object Kernel.class_eval File.read(path) self.class.objects[@klass] = eval(klass.to_s).new(conn) end end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
93 94 95 |
# File 'lib/builder/node.rb', line 93 def command @command end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
92 93 94 |
# File 'lib/builder/node.rb', line 92 def klass @klass end |
Instance Method Details
#call ⇒ Object
111 112 113 |
# File 'lib/builder/node.rb', line 111 def call() object.send(@command, *args) end |
#inspect ⇒ Object
115 |
# File 'lib/builder/node.rb', line 115 def inspect() "#{path} #{klass}##{command}" end |
#object ⇒ Object
94 |
# File 'lib/builder/node.rb', line 94 def object() self.class.objects[klass] end |