Module: NMap::Util

Included in:
NMap, Header
Defined in:
lib/nmap.rb

Instance Method Summary collapse

Instance Method Details

#int_list_of(obj) ⇒ Object



32
33
34
35
36
# File 'lib/nmap.rb', line 32

def int_list_of obj
  [*obj].flatten.map{|elem| int_of elem}
rescue
  raise ArgumentError, "cannot convert <#{ obj.inspect }> to int list"
end

#int_of(obj) ⇒ Object



26
27
28
29
30
# File 'lib/nmap.rb', line 26

def int_of obj
  Integer obj
rescue
  raise ArgumentError, "cannot convert <#{ obj.inspect }> to int"
end

#string_of(obj) ⇒ Object



20
21
22
23
24
# File 'lib/nmap.rb', line 20

def string_of obj
  obj.to_str
rescue
  raise ArgumentError, "cannot convert <#{ obj.inspect }> to string"
end