class Fuzz::FileObject

Constants

EXTS
FILES

Attributes

ext[R]
fullpath[R]
lines[R]
name[R]
path[R]

Public Class Methods

extensions() click to toggle source
# File lib/fuzz/fzzr.rb, line 120
def self.extensions
  EXTS
end
filenames() click to toggle source
# File lib/fuzz/fzzr.rb, line 124
def self.filenames
  FILES
end
new(path) click to toggle source
# File lib/fuzz/fzzr.rb, line 226
def initialize(path)
  @path = path
  @fullpath = File.expand_path(path)
  @name = File.basename(path)
  @ext = File.extname(path).sub(/^\./,'')
  @lines = nil
  @pointer = nil
  @changed = false
end

Public Instance Methods

changed?() click to toggle source
# File lib/fuzz/fzzr.rb, line 236
def changed?
  @changed
end
iterate(fzzr_id, &block) click to toggle source
# File lib/fuzz/fzzr.rb, line 240
def iterate(fzzr_id, &block)
  @lines ||= IO.readlines(fullpath)
  lines_copy = @lines.collect {|l| l.dup }
  pointer = LinePointer.new(@lines, fzzr_id)
  begin
    block.call(pointer) unless pointer.fzzr_disabled?
    pointer.move(1)
  end while !pointer.eof?
  Fuzz.log_error(%Q{#{self.path}[#{pointer.err_lines.join(',')}] #{Fuzz.get_fzzr(fzzr_id).errormsg}}) unless pointer.err_lines.empty?
  @changed |= (@lines != lines_copy)
  lines_copy = nil
  return pointer.err_lines.empty?
end
to_s() click to toggle source
# File lib/fuzz/fzzr.rb, line 254
def to_s
  "File:#{fullpath}"
end