module SugarHigh::FileExt

Public Instance Methods

blank?() click to toggle source

instance methods

# File lib/sugar-high/file_ext.rb, line 47
def blank?
  File.zero?(self.path)
end
has_content?(content_matcher = nil) { || ... } click to toggle source
# File lib/sugar-high/file_ext.rb, line 51
def has_content? content_matcher = nil, &block
  content_matcher ||= yield
  begin
    content_matcher = content_matcher.to_regexp
  rescue
    raise ArgumentError, "Content match must be specified as either a String or Regexp"
  end
  matched = self.read_content =~ content_matcher
  !(matched).nil?
end
read_content(options = {}) click to toggle source
# File lib/sugar-high/file_ext.rb, line 62
def read_content options = {}, &block
  File.read_from self.path, options, &block
end
Also aliased as: with_content
with_content(options = {})
Alias for: read_content