Top Level Namespace
Defined Under Namespace
Modules: Construqt
Classes: Test, Test2
Constant Summary
collapse
- CONSTRUQT_PATH =
ENV['CONSTRUQT_PATH']||'..'
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.test ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/construqt/tests/test_utils.rb', line 27
def self.test
3.times do |i|
t = Test.new
throw "chainable failed test should 2 #{t.get_test.inspect}" if t.get_test != 2
t.test
throw "chainable failed this should be 1 " if t.get_test != 1
t.test(3)
throw "chainable failed" if t.get_test != 3
throw "chainable failed test should 2 #{t.get_testside.inspect}" if t.get_testside != 2
throw "chainable failed sideeffect should 1 nil #{t.sideeffect.inspect}" if !t.sideeffect.nil?
t.testside
throw "chainable failed this should be 1 " if t.get_testside != 1
throw "chainable failed sideeffect should 2 nil #{t.sideeffect.inspect}" if t.sideeffect != 10
t.testside(3)
throw "chainable failed" if t.get_testside != 3
throw "chainable failed sideeffect should 2 nil #{t.sideeffect.inspect}" if t.sideeffect != 11
throw "chainable failed true" unless t.testbool? == true
t.testbool
throw "chainable failed false" unless t.testbool? == false
t.testbool(4)
throw "chainable failed 4" unless t.testbool? == 4
t.testbool
throw "chainable failed false" unless t.testbool? == false
throw "chainable failed 2 true" unless t.testbool2? == true
t.testbool2
throw "chainable failed 2 false" unless t.testbool2? == true
t.testbool2(4)
throw "chainable failed 2 4" unless t.testbool2? == 4
t.testbool2
throw "chainable failed 2 false" unless t.testbool2? == true
end
a=[Test.new,Test.new,Test.new]
a[0].testbool(0)
throw "chainable failed 0" unless a[0].testbool? == 0
throw "chainable failed 1" unless a[1].testbool? == true
a[2].testbool
throw "chainable failed 2" unless a[2].testbool? == false
throw "chainable failed 0" unless a[0].testbool? == 0
throw "chainable failed 1" unless a[1].testbool? == true
throw "chainable failed 2" unless a[2].testbool? == false
end
|
Instance Method Details
#render_iface(ifaces, routes) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/construqt/reverse.rb', line 20
def render_iface(ifaces, routes)
ifaces.interfaces.map do |iface|
next [] if iface.name == 'lo'
next [] if iface.ips.empty?
out = <<RUBY
region.interfaces.add_device(host, "#{iface.name}", "mtu" => 1500,
'mac_address' => #{iface.mac_address},
'address' => region.network.addresses.
#{Construqt::Util.indent((
iface.ips.map{|i| "add_ip('#{i.to_s}')" }+
(routes.interfaces[iface.name] ? routes.interfaces[iface.name].select{|i| i.kind_of?(Linux::Ip::Route::IpRoute::ViaRoute) }.map{|i| "add_route('#{i.dst.to_s}', '#{i.via.to_s}')" } : [])).join(".\n"), 22)})
RUBY
end.join("\n")
end
|