Class: FileLines

Inherits:
Array show all
Defined in:
lib/innate/filelines.rb

Overview

load is not currently thread safe.

Instance Method Summary collapse

Methods inherited from Array

#columns, #match?, #pc, #pr, #rows

Constructor Details

#initialize(fn) ⇒ FileLines

Returns a new instance of FileLines.



4
5
6
7
8
# File 'lib/innate/filelines.rb', line 4

def initialize(fn)
  @fn = fn
  @init = false
  @loaded_all = false
end

Instance Method Details

#[](r) ⇒ Object



17
18
19
20
# File 'lib/innate/filelines.rb', line 17

def [](r)
  load r
  super
end

#[]=(i, v) ⇒ Object



22
23
24
# File 'lib/innate/filelines.rb', line 22

def []=(i, v)
  super
end

#at(i) ⇒ Object



12
13
14
15
# File 'lib/innate/filelines.rb', line 12

def at(i)
  load i
  super
end

#at_before_file_linesObject



10
# File 'lib/innate/filelines.rb', line 10

alias_method :at_before_file_lines, :[]

#collectObject



54
55
56
57
# File 'lib/innate/filelines.rb', line 54

def collect
  load_all
  super
end

#eachObject



41
42
43
44
# File 'lib/innate/filelines.rb', line 41

def each
  load_all
  super
end

#firstObject



46
47
48
# File 'lib/innate/filelines.rb', line 46

def first
  at 0
end

#lastObject



50
51
52
# File 'lib/innate/filelines.rb', line 50

def last
  at length - 1
end

#lengthObject



26
27
28
29
# File 'lib/innate/filelines.rb', line 26

def length
  init
  super
end

#sizeObject



31
32
33
34
# File 'lib/innate/filelines.rb', line 31

def size
  init
  super
end

#values_at(*a) ⇒ Object



36
37
38
39
# File 'lib/innate/filelines.rb', line 36

def values_at(*a)
  load(*a)
  super
end