class Rouge::FileReader
def file
def file case input when '-' IO.new($stdin.fileno, 'r:utf-8') when String File.new(input, 'r:utf-8') 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