In Files

Parent

Methods

Class/Module Index [+]

Quicksearch

Rouge::FileReader

Attributes

input[R]

Public Class Methods

new(input) click to toggle source
# File lib/rouge/cli.rb, line 7
def initialize(input)
  @input = input
end

Public Instance Methods

file() click to toggle source
# File lib/rouge/cli.rb, line 11
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/rouge/cli.rb, line 22
def read
  @read ||= begin
    file.read
  rescue => e
    $stderr.puts "unable to open #{input}: #{e.message}"
    exit 1
  ensure
    file.close
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.