class Spellr::File
Public Instance Methods
first_line()
click to toggle source
the bulk of this method is copied from fast_ignore
# File lib/spellr/file.rb, line 19 def first_line # rubocop:disable Metrics/MethodLength return @first_line if defined?(@first_line) @first_line = nil file = ::File.new(to_s) @first_line = file.sysread(25) @first_line += file.sysread(50) until @first_line.include?("\n") file.close @first_line rescue ::EOFError, ::SystemCallError # :nocov: file&.close # :nocov: @first_line end
insert(string, range)
click to toggle source
# File lib/spellr/file.rb, line 11 def insert(string, range) read_write do |body| body[range] = string body end end
read_write() { |read)| ... }
click to toggle source
# File lib/spellr/file.rb, line 36 def read_write write(yield read) end
relative_path()
click to toggle source
# File lib/spellr/file.rb, line 7 def relative_path @relative_path ||= relative_path_from(Spellr.pwd) end