class Rouge::FileReader

def file

def file
  case input
  when '-'
    $stdin
  when String
    File.new(input)
  when ->(i){ i.respond_to? :read }
    input
  end
end

def initialize(input)

def initialize(input)
  @input = input
end

def read

def read
  @read ||= begin
    file.read
  rescue => e
    $stderr.puts "unable to open #{input}: #{e.message}"
    exit 1
  ensure
    file.close
  end
end