Method: YARD::Parser::Ruby::RipperParser#file_encoding

Defined in:
lib/yard/parser/ruby/ruby_parser.rb

#file_encodingObject

Since:

  • 0.5.6


62
63
64
65
66
67
68
69
# File 'lib/yard/parser/ruby/ruby_parser.rb', line 62

def file_encoding
  return nil unless defined?(::Encoding)
  return @file_encoding if @file_encoding
  return Encoding.default_internal unless @encoding_line
  if match = @encoding_line.match(SourceParser::ENCODING_LINE)
    @file_encoding = match.captures.last
  end
end