Class: Linux::Lxc::Lines
- Inherits:
-
Object
- Object
- Linux::Lxc::Lines
- Defined in:
- lib/linux/lxc/lines.rb
Instance Method Summary collapse
- #[](idx) ⇒ Object
- #add(line) ⇒ Object
- #comment! ⇒ Object
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
- #find(&block) ⇒ Object
- #first ⇒ Object
-
#initialize ⇒ Lines
constructor
A new instance of Lines.
- #length ⇒ Object
- #remove(line) ⇒ Object
- #select(&block) ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize ⇒ Lines
Returns a new instance of Lines.
4 5 6 |
# File 'lib/linux/lxc/lines.rb', line 4 def initialize @lines = [] end |
Instance Method Details
#[](idx) ⇒ Object
33 34 35 |
# File 'lib/linux/lxc/lines.rb', line 33 def [](idx) @lines[idx] end |
#add(line) ⇒ Object
8 9 10 11 |
# File 'lib/linux/lxc/lines.rb', line 8 def add(line) @lines << line @lines end |
#comment! ⇒ Object
37 38 39 |
# File 'lib/linux/lxc/lines.rb', line 37 def comment! @lines.each(&:comment!) end |
#each(&block) ⇒ Object
13 14 15 |
# File 'lib/linux/lxc/lines.rb', line 13 def each(&block) @lines.each { |line| block.call(line) } end |
#empty? ⇒ Boolean
45 46 47 |
# File 'lib/linux/lxc/lines.rb', line 45 def empty? @lines.empty? end |
#find(&block) ⇒ Object
21 22 23 |
# File 'lib/linux/lxc/lines.rb', line 21 def find(&block) @lines.find(&block) end |
#first ⇒ Object
49 50 51 |
# File 'lib/linux/lxc/lines.rb', line 49 def first @lines.first end |
#length ⇒ Object
41 42 43 |
# File 'lib/linux/lxc/lines.rb', line 41 def length @lines.length end |
#remove(line) ⇒ Object
29 30 31 |
# File 'lib/linux/lxc/lines.rb', line 29 def remove(line) @lines = @lines.select { |i| i != line } end |
#select(&block) ⇒ Object
17 18 19 |
# File 'lib/linux/lxc/lines.rb', line 17 def select(&block) @lines.select { |line| block.call(line) } end |
#values ⇒ Object
25 26 27 |
# File 'lib/linux/lxc/lines.rb', line 25 def values @lines.map(&:value) end |