class Linux::Lxc::Line

Attributes

key[R]
line[R]
lxc[R]
value[RW]

Public Class Methods

new(lxc, key, value) click to toggle source
# File lib/linux/lxc/line.rb, line 6
def initialize(lxc, key, value)
  @lxc = lxc
  @line = lxc && lxc.lines.add(self).length
  @key = key
  @value = value
end

Public Instance Methods

comment!() click to toggle source
# File lib/linux/lxc/line.rb, line 17
def comment!
  return if @key == '#'
  # remove from index
  lxc.remove_from_index(self)
  uncomment = to_s
  @key = '#'
  @value = '# ' + uncomment
  lxc.add_to_index(self)
end
file() click to toggle source
# File lib/linux/lxc/line.rb, line 13
def file
  @lxc.file
end
to_s() click to toggle source
# File lib/linux/lxc/line.rb, line 27
def to_s
  if value
    if key == '#'
      value
    else
      "#{key} = #{value}"
    end
  else
    key
  end
end