Top Level Namespace

Defined Under Namespace

Modules: CARPS Classes: ERB, Hash, K, V

Instance Method Summary collapse

Instance Method Details

#protoval(keyword) ⇒ Object

Declare a new protocol keyword which is associated with a value



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/carps/protocol/keyword.rb', line 28

def protoval keyword
   # Use the OLD SKOOL for ruby 1.8 support
   K.class_eval "   def K.\#{keyword.to_s}\n      prefix + \"\#{keyword.to_s}\" + keyword_end\n   end\n   END\n\n   V.class_eval <<-\"END\"\n   def V.\#{keyword.to_s} data\n      prefix + \"\#{keyword.to_s}\" + keyword_end + data + K.end\n   end\n   END\nend\n"

#protoword(keyword) ⇒ Object

Declare a new protocol keyword which is a flag or marker



44
45
46
47
48
49
50
# File 'lib/carps/protocol/keyword.rb', line 44

def protoword keyword
   K.class_eval "   def K.\#{keyword.to_s}\n      mark_prefix + \"\#{keyword.to_s}\" + keyword_end\n   end\n   END\nend\n"

#test_ipc(process, mut) ⇒ Object

Test IPC



148
149
150
# File 'lib/carps/util/process.rb', line 148

def test_ipc process, mut
   process.launch mut, "carps_ipc_test"
end

#with_valid_port(pst) ⇒ Object

Perform an action if the string describes a valid port number



487
488
489
490
491
492
493
494
# File 'lib/carps/wizard/steps.rb', line 487

def with_valid_port pst
   port = pst.to_i
   if port > 0 and port <= 65535
      yield port
   else
      puts "The port must be a natural number, greater than zero and less than 65535."
   end
end