Class: EC2::Platform::Linux::Mtab::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2/platform/linux/mtab.rb

Constant Summary collapse

REGEX =
/^(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*$/

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dev, mnt_point, fs_type, opts, line) ⇒ Entry

Returns a new instance of Entry.



25
26
27
28
29
30
31
# File 'lib/ec2/platform/linux/mtab.rb', line 25

def initialize(dev, mnt_point, fs_type, opts, line)
  @device = dev
  @mpoint = mnt_point
  @fstype = fs_type
  @options= opts
  @value  = line
end

Instance Attribute Details

#deviceObject (readonly)

mounted device.



18
19
20
# File 'lib/ec2/platform/linux/mtab.rb', line 18

def device
  @device
end

#fstypeObject (readonly)

file system type.



20
21
22
# File 'lib/ec2/platform/linux/mtab.rb', line 20

def fstype
  @fstype
end

#mpointObject (readonly)

mount point.



19
20
21
# File 'lib/ec2/platform/linux/mtab.rb', line 19

def mpoint
  @mpoint
end

#optionsObject (readonly)

options



21
22
23
# File 'lib/ec2/platform/linux/mtab.rb', line 21

def options
  @options
end

#valueObject (readonly)

entire line



22
23
24
# File 'lib/ec2/platform/linux/mtab.rb', line 22

def value
  @value
end

Class Method Details

.parse(line) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/ec2/platform/linux/mtab.rb', line 33

def self.parse(line)
  return nil if line[0,1] == '#'
  if (m = REGEX.match(line))
    parts = m.captures
    return Entry.new(parts[0], parts[1], parts[2], parts[3], line.strip)
  else
    return nil
  end
end

Instance Method Details



47
48
49
# File 'lib/ec2/platform/linux/mtab.rb', line 47

def print
  puts(to_s)
end

#to_sObject



43
44
45
# File 'lib/ec2/platform/linux/mtab.rb', line 43

def to_s
  value
end