class Plaintext::FileHandler

Public Instance Methods

accept?(content_type) click to toggle source
# File lib/plaintext/file_handler.rb, line 5
def accept?(content_type)
  if @content_type
    content_type == @content_type
  elsif @content_types
    @content_types.include? content_type
  else
    false
  end
end
set(args = {}) click to toggle source

use `#set(max_size: 1.megabyte)` to give an upper limit of data to be read.

By default, all data (whole file / command output) will be read which can be a problem with huge text files (eg SQL dumps)

# File lib/plaintext/file_handler.rb, line 19
def set(args = {})
  options.update args
  self
end

Private Instance Methods

max_size() click to toggle source

maximum number of bytes to read from external command output or text files

# File lib/plaintext/file_handler.rb, line 28
def max_size
  options[:max_size]
end
options() click to toggle source
# File lib/plaintext/file_handler.rb, line 32
def options
  @options ||= {}
end