Class: Arver::Partition
Instance Attribute Summary collapse
#post_close, #post_open, #pre_close, #pre_open
#name, #parent
Instance Method Summary
collapse
#script_hooks_from_hash, #script_hooks_to_yaml
#add_child, #child, #children, #each_node, #find, #has_child?, #has_parent?, #path, #target?, #to_ascii
Constructor Details
#initialize(name, host) ⇒ Partition
Returns a new instance of Partition.
8
9
10
11
12
|
# File 'lib/arver/partition.rb', line 8
def initialize(name, host)
self.name = name
self.device = ''
self.parent = host
end
|
Instance Attribute Details
#device ⇒ Object
Returns the value of attribute device.
6
7
8
|
# File 'lib/arver/partition.rb', line 6
def device
@device
end
|
Instance Method Details
#==(other_partition) ⇒ Object
18
19
20
21
|
# File 'lib/arver/partition.rb', line 18
def ==(other_partition)
return name == other_partition.name && device == other_partition.device if other_partition.is_a?(Arver::Partition)
false
end
|
#device_path ⇒ Object
49
50
51
52
|
# File 'lib/arver/partition.rb', line 49
def device_path
return self.device if self.device =~ /^\/dev\//
"/dev/#{self.device}"
end
|
#each_partition {|_self| ... } ⇒ Object
14
15
16
|
# File 'lib/arver/partition.rb', line 14
def each_partition(&blk)
yield self
end
|
#from_hash(hash) ⇒ Object
30
31
32
33
34
35
|
# File 'lib/arver/partition.rb', line 30
def from_hash( hash )
script_hooks_from_hash( hash )
hash.each do | name, data |
self.device= data if name == "device"
end
end
|
#pre_execute(action) ⇒ Object
37
38
39
|
# File 'lib/arver/partition.rb', line 37
def pre_execute( action )
return action.pre_run_execute_partition(self)
end
|
#run_action(action) ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/arver/partition.rb', line 41
def run_action( action )
if( action.verify?( self ) )
action.pre_partition(self)
action.execute_partition(self)
action.post_partition(self)
end
end
|
#to_yaml ⇒ Object
23
24
25
26
27
28
|
# File 'lib/arver/partition.rb', line 23
def to_yaml
yaml = ""
yaml += "'device': '#{device}'\n"
yaml += script_hooks_to_yaml
yaml.chop
end
|