b0VIM 7.4pXjdanok~dan/dev/gems/code/lib/code.rbutf-8 3210#"! Utp@ad @uTNM8 hTNM, t P $ d ^ ] ? ' K  T ' !  $ eeend end "https://github.com/ruby/ruby/blob/ruby_#{RUBY_VERSION[0]}_#{RUBY_VERSION[2]}/#{filename}#L#{line}" def self.cruby_on_github(filename, line) end end display location + comment + source, :c comment = method_info.docstring ? method_info.docstring.gsub(/^/, '// ') + "\n" : "" location = "//\n// #{cruby_on_github(method_info.file, method_info.line)}\n//\n" source = method_info.source else raise Code::NotFound, 'Method source not found.' elsif !(method_info = CoreDocs::MethodInfo.info_for(m)) raise Code::NotFound, 'Method source not found. Might be possible with core_docs gem' elsif !defined?(CoreDocs) raise Code::NotFound, "Method source not found for non-CRuby." if RUBY_ENGINE != "ruby" def self.from_docs(m) # Find C definition of Code end display location + comment + source location = m.source_location ? "#\n# #{ m.source_location*':' }\n#\n" : "" comment = m.comment && !m.comment.empty? ? "#{ m.comment }" : "" source = source.gsub(/^#{indent}/,"") indent = source.match(/\A +/) source = m.source || "" def self.from_ruby(m) # Find Ruby definition of code end puts CodeRay.scan(string, language).term def self.display(string, language = :ruby) # Syntax highlight code string end warn $!.message rescue NameError, NotFound end from_docs(m) rescue MethodSource::SourceNotFoundError from_ruby(m) begin m = object.method(method_name) def self.for(object = self, method_name) # API for end user end class NotFound < StandardErrormodule Codeendrescue LoadError require 'core_docs'beginrequire 'coderay'require 'method_source'require_relative "code/version"