Class: RbTags::File
Instance Method Summary collapse
-
#initialize(file, line) ⇒ File
constructor
A new instance of File.
- #line ⇒ Object
- #name ⇒ Object
Constructor Details
#initialize(file, line) ⇒ File
4 5 6 |
# File 'lib/rbtags/file.rb', line 4 def initialize(file, line) @file, @line = file, Integer(line) end |
Instance Method Details
#line ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rbtags/file.rb', line 13 def line @@lines ||= Hash.new{ |lines, file| sum = 0 lines[file] = File.open(file, 'rb'){ |io| io.map{ |line| line.chomp } } } @@lines[@file][@line - 1] end |
#name ⇒ Object
8 9 10 11 |
# File 'lib/rbtags/file.rb', line 8 def name ||= Hash.new{ |files, file| files[file] = File.(file) } [@file] end |