Class: EC2::Platform::Linux::Fstab::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2/platform/linux/fstab.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.



31
32
33
34
35
36
37
# File 'lib/ec2/platform/linux/fstab.rb', line 31

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.



25
26
27
# File 'lib/ec2/platform/linux/fstab.rb', line 25

def device
  @device
end

#fstypeObject (readonly)

file system type.



27
28
29
# File 'lib/ec2/platform/linux/fstab.rb', line 27

def fstype
  @fstype
end

#mpointObject (readonly)

mount point.



26
27
28
# File 'lib/ec2/platform/linux/fstab.rb', line 26

def mpoint
  @mpoint
end

#optionsObject (readonly)

options



28
29
30
# File 'lib/ec2/platform/linux/fstab.rb', line 28

def options
  @options
end

#valueObject (readonly)

everything on line



29
30
31
# File 'lib/ec2/platform/linux/fstab.rb', line 29

def value
  @value
end

Class Method Details

.parse(line) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/ec2/platform/linux/fstab.rb', line 39

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



53
54
55
# File 'lib/ec2/platform/linux/fstab.rb', line 53

def print
  puts(to_s)
end

#to_sObject



49
50
51
# File 'lib/ec2/platform/linux/fstab.rb', line 49

def to_s
  value
end