Class: Assembly

Inherits:
Object
  • Object
show all
Defined in:
lib/ebngen/assembly.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Assembly

Returns a new instance of Assembly.



5
6
7
# File 'lib/ebngen/assembly.rb', line 5

def initialize(options)
	@internal_hash = options
end

Instance Method Details

#assembly(project_name, key = "__add__") ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/ebngen/assembly.rb', line 8

def assembly(project_name, key = "__add__")
	@internal_hash[project_name][key].each do |submodule|
		@internal_hash[project_name].deep_merge(deep_copy(@internal_hash[submodule]))
	end
	@internal_hash[project_name].delete(key)
	@internal_hash.keys.each do |subkey|
		next if subkey == project_name
		@internal_hash.delete(subkey)
	end
end

#deep_copy(o) ⇒ Object



19
20
21
# File 'lib/ebngen/assembly.rb', line 19

def deep_copy(o)
  Marshal.load(Marshal.dump(o))
end