Class: NMap::Header
- Inherits:
-
Hash
show all
- Includes:
- Util
- Defined in:
- lib/nmap.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Util
#int_list_of, #int_of, #string_of
Constructor Details
#initialize(path, *argv) ⇒ Header
Returns a new instance of Header.
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/nmap.rb', line 42
def initialize path, *argv
@path = string_of path
self.na_type = argv.shift
self.shape = argv
self.na_type = int_of na_type if na_type
self.shape = int_list_of shape if shape
init! if na_type and shape
load!
end
|
Class Method Details
.init(*a, &b) ⇒ Object
80
|
# File 'lib/nmap.rb', line 80
def self.init(*a, &b) new(*a, &b) end
|
Instance Method Details
#init! ⇒ Object
56
57
58
|
# File 'lib/nmap.rb', line 56
def init!
open(@path, "w"){|f| ::YAML::dump(({}.update self), f)}
end
|
#load! ⇒ Object
60
61
62
|
# File 'lib/nmap.rb', line 60
def load!
self.update(open(@path){|f| ::YAML::load f})
end
|
#na_type ⇒ Object
64
65
66
|
# File 'lib/nmap.rb', line 64
def na_type
self["na_type"]
end
|
#na_type=(val) ⇒ Object
68
69
70
|
# File 'lib/nmap.rb', line 68
def na_type= val
self["na_type"] = val
end
|
#shape ⇒ Object
72
73
74
|
# File 'lib/nmap.rb', line 72
def shape
self["shape"]
end
|
#shape=(val) ⇒ Object
76
77
78
|
# File 'lib/nmap.rb', line 76
def shape= val
self["shape"] = val
end
|