class Khaleesi::CLI::FileReader
Attributes
input[R]
Public Class Methods
new(input)
click to toggle source
# File lib/khaleesi/cli.rb, line 590 def initialize(input) @input = input end
Public Instance Methods
file()
click to toggle source
# File lib/khaleesi/cli.rb, line 594 def file case input when '-' $stdin when String File.new(input) when ->(i){ i.respond_to? :read } input end end
read()
click to toggle source
# File lib/khaleesi/cli.rb, line 605 def read @read ||= begin file.read rescue => e $stderr.puts "unable to open #{input}: #{e.message}" exit 1 ensure file.close end end