Giter Club home page Giter Club logo

documenting-ruby / ruby Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ruby/ruby

60.0 10.0 117.0 150.61 MB

A concerted effort to augment and enhance Ruby MRI documentation

Home Page: http://documenting-ruby.org/

License: Other

Prolog 0.01% Ruby 63.20% C 34.68% Perl 0.01% Python 0.01% Scheme 0.01% Perl 6 0.01% Makefile 0.40% HTML 0.82% C++ 0.14% Shell 0.02% Ragel in Ruby Host 0.08% Groff 0.01% Tcl 0.15% Assembly 0.01% CSS 0.05% JavaScript 0.05% Emacs Lisp 0.36% Awk 0.01% XSLT 0.04%

ruby's Introduction

What's Ruby

Ruby is the interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in Perl). It is simple, straight-forward, and extensible.

Features of Ruby

  • Simple Syntax
  • Normal Object-oriented Features (e.g. class, method calls)
  • Advanced Object-oriented Features (e.g. Mix-in, Singleton-method)
  • Operator Overloading
  • Exception Handling
  • Iterators and Closures
  • Garbage Collection
  • Dynamic Loading of Object Files (on some architectures)
  • Highly Portable (works on many Unix-like/POSIX compatible platforms as well as Windows, Mac OS X, BeOS, etc.) cf. http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/SupportedPlatforms

How to get Ruby

For a complete list of ways to install Ruby, including using third-party tools like rvm, see:

http://www.ruby-lang.org/en/downloads/

The Ruby distribution files can be found on the following FTP site:

ftp://ftp.ruby-lang.org/pub/ruby/

The trunk of the Ruby source tree can be checked out with the following command:

$ svn co http://svn.ruby-lang.org/repos/ruby/trunk/ ruby

Or if you are using git then use the following command:

$ git clone git://github.com/ruby/ruby.git

There are some other branches under development. Try the following command to see the list of branches:

$ svn ls http://svn.ruby-lang.org/repos/ruby/branches/

Or if you are using git then use the following command:

$ git ls-remote git://github.com/ruby/ruby.git

Ruby home page

The URL of the Ruby home page is:

http://www.ruby-lang.org/

Mailing list

There is a mailing list to talk about Ruby. To subscribe this list, please send the following phrase:

subscribe

in the mail body (not subject) to the address mailto:[email protected].

How to compile and install

This is what you need to do to compile and install Ruby:

  1. If you want to use Microsoft Visual C++ to compile ruby, read win32/README.win32 instead of this document.

  2. If ./configure does not exist or is older than configure.in, run autoconf to (re)generate configure.

  3. Run ./configure, which will generate config.h and Makefile.

    Some C compiler flags may be added by default depending on your environment. Specify optflags=.. and warnflags=.. as necessary to override them.

  4. Edit defines.h if you need. Usually this step will not be needed.

  5. Remove comment mark(#) before the module names from ext/Setup (or add module names if not present), if you want to link modules statically.

    If you don't want to compile non static extension modules (probably on architectures which do not allow dynamic loading), remove comment mark from the line "#option nodynamic" in ext/Setup.

    Usually this step will not be needed.

  6. Run make.

  7. Optionally, run 'make check' to check whether the compiled Ruby interpreter works well. If you see the message "check succeeded", your ruby works as it should (hopefully).

  8. Run 'make install'

    This command will create following directories and install files onto them.

    • ${DESTDIR}${prefix}/bin
    • ${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}
    • ${DESTDIR}${prefix}/include/ruby-${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
    • ${DESTDIR}${prefix}/lib
    • ${DESTDIR}${prefix}/lib/ruby
    • ${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}
    • ${DESTDIR}${prefix}/lib/ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
    • ${DESTDIR}${prefix}/lib/ruby/site_ruby
    • ${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}
    • ${DESTDIR}${prefix}/lib/ruby/site_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
    • ${DESTDIR}${prefix}/lib/ruby/vendor_ruby
    • ${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}
    • ${DESTDIR}${prefix}/lib/ruby/vendor_ruby/${MAJOR}.${MINOR}.${TEENY}/${PLATFORM}
    • ${DESTDIR}${prefix}/lib/ruby/gems/${MAJOR}.${MINOR}.${TEENY}
    • ${DESTDIR}${prefix}/share/man/man1
    • ${DESTDIR}${prefix}/share/ri/${MAJOR}.${MINOR}.${TEENY}/system

    If Ruby's API version is 'x.y.z', the ${MAJOR} is 'x', the ${MINOR} is 'y', and the ${TEENY} is 'z'.

    NOTE: teeny of the API version may be different from one of Ruby's program version

    You may have to be a super user to install ruby.

If you fail to compile ruby, please send the detailed error report with the error log and machine/OS type, to help others.

Some extension libraries may not get compiled because of lack of necessary external libraries and/or headers, then you will need to run 'make distclean-ext' to remove old configuration after installing them in such case.

Copying

See the file COPYING.

Feedback

Questions about the Ruby language can be asked on the Ruby-Talk mailing list (http://www.ruby-lang.org/en/community/mailing-lists) or on websites like (http://stackoverflow.com).

Bug reports should be filed at http://bugs.ruby-lang.org. Read HowToReport for more information.

##Contributing

See the file CONTRIBUTING.md

The Author

Ruby was originally designed and developed by Yukihiro Matsumoto (Matz) in 1995.

mailto:[email protected]

ruby's People

Contributors

akr avatar authornari avatar ayumin avatar drbrain avatar duerst avatar eban avatar eregon avatar hsbt avatar k-tsj avatar knu avatar ko1 avatar kou avatar mame avatar marcandre avatar matzbot avatar mrkn avatar nagachika avatar nobu avatar nurse avatar shirosaki avatar shugo avatar shyouhei avatar sorah avatar suketa avatar tarui avatar tenderlove avatar tmm1 avatar unak avatar yugui avatar znz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby's Issues

Documentation for the 'shell' library

Hi, I wanted to see if I could help fill in the docs for shell. A lot of the classes in that namespace don't have descriptions for their methods yet.

Has someone else prioritized this or can I go ahead?

Also I'd like to know where you would prefer people to offer documentation when they do... In this repo? In the main Ruby repo on github? I've seen people do both. Thanks!!

Hash: JavaScript-like colon notation allowed for Symbol keys, even when other key in the same Hash aren't Symbols

On http://ruby-doc.org/core-2.2.2/Hash.html#method-i-store, the notation { my_key: 5 } (available since Ruby 1.9) is introduced with

Hashes allow an alternate syntax form when your keys are always symbols.

(Emphasis mine.)

This suggests that this syntax will only be allowed for literals of Hashes where all keys are are Symbols. However, experiments show it works fine for Hashes of mixed key types:

{"a string" => 1, a_symbol: 2, Math::PI => 3 }

(Of course, the colon syntax can only be used for those keys that are Symbols.)

When submitting documentation issues, the "guidelines for contributing" link seems wrong

At http://documenting-ruby.org/ it says that documentation issues should be opened at https://github.com/documenting-ruby/ruby/issues/new

But when I visit https://github.com/documenting-ruby/ruby/issues/new, there is a message above the submission form: "Please review the guidelines for contributing to this repository." That link goes to a page directing me to open issues at https://bugs.ruby-lang.org.

It seems to me that documentation issues really are supposed to be logged here, not at https://bugs.ruby-lang.org, right? Is it possible to change the "Please review the guidelines for contributing to this repository." message in this fork? Maybe the link could go to http://documenting-ruby.org/ instead?

Add version switcher to docs site?

I just searched the web for "ruby StringIO" and landed on the 1.9.3 documentation. I wanted to see the StringIO docs for a version >= 2.0. There is currently no easy way to get from one to the other, and no way to predict which version a search engine will find first.

Could we add a dropdown on each doc page, linking to the corresponding page for other versions of Ruby? If there are too many, maybe it could be limited to the most recent N releases, or the the most recent N on each branch.

Enumerable#map and #collect with #lazy and docs

This says that #map returns an_enumerator and a new array:

http://ruby-doc.org/core-2.4.0/Enumerable.html#method-i-map

irb says:

irb(main):002:0> [1,2,3].map {|x| x+1}.class
=> Array
irb(main):003:0> [1,2,3].lazy.map {|x| x+1}.class
=> Enumerator::Lazy

and Lazy docs says nothing about behaving differently.

and i can be hallucinating, but i remember seeing different things about #map and #collect on this page, saying that #map would return enumerator and #collect would return array.

<3

Symbol public instance method == duplicated in docs

Hi!

I noticed that the Symbol Public Instance Method == was duplicated in the ruby-docs site. I checked the string.c file in the documenting-ruby/ruby repo, but it does not seem duplicated there. Perhaps an issue occurs in the generation of the documentation? Attached is a screenshot.

Let me know if I can do anything!

Kindly,
Emily


screen shot 2014-07-31 at 9 57 25 am

OpenSSL SNI documentation

We had an issue where we had to figure out a way to make the following command work through Ruby's stdlib:

echo | openssl s_client -connect google.com:443 -servername google.com 2>/dev/null | openssl x509 -noout -fingerprint

Note the -servername option

I spent a lot of time looking around, first looking at the servername_cb callback (which in itself is poorly documented if at all), only later realizing there's a hostname attribute on OpenSSL::SSL::SSLContext

In case you're not familiar with the servername option, it's used to get the correct certificate on a domain name where the host uses Server Name Indication or SNI in short.

enumerable: collect_concat documents flat_map

The collect and map documentation are the same, and show examples of each to enforce this. There's no mention however that they are aliases for the same code (but that's another issue for later).

However the collect_concat and flat_map documentation only shows examples of code using flat_map. There's no mention that these one is an alias for another, and the example never shows collect_concat.

I propose (and will file a PR) that we have one example of collect_concat and one of flat_map to demonstrate that these are the same. Otherwise, looking at the documentation for collect_concat and not seeing a code example of it being used is confusing and inconsistent.

Documenting OpenSSL::HMAC

I'd like to add code examples to the documentation for OpenSSL::HMAC. I had to use it recently and want to help make its usage more obvious. Is this up for grabs?

Why is Dir.children documented for Ruby 2.4.1?

The Dir.children method was added to Ruby trunk with Feature #11302. It was however not backported to Ruby 2.4 yet. Attempting to use it results in a NoMethodError in Ruby.

However, the method documentation is added to the Ruby 2.4.1 documentation at https://ruby-doc.org/core-2.4.1/Dir.html#method-c-children. Why is this the case? The method is not part of Ruby 2.4 and is (as far as I can see) not mentioned in the source code.

This was also asked and investigated at https://stackoverflow.com/a/45719685/421705

Refactor some `Forwardable` documentation

This doesn't really scan:

screen shot 2015-10-30 at 14 25 57

Clearly the idea is to suggest the use of Forwardable as an alternative to classical inheritance, but it doesn't come across very clearly.

Documenting global variables (particularly IO instances)

I was trying to explain puts to someone, and noticed that the documentation says that puts is "equivalent to $stdout.puts" That led me to try and track down where to explain what $stdout refers to but I couldn't find any obvious place to add it in... I'd imagine it'd have to be somewhere in a list of "default Ruby global variables," but it isn't clear to me where that should be.

Should the documentation for IO be the place to list at least global variables of that class?

Document implicit conversion calls in Ruby Core classes

Document cases in Ruby Core where Ruby classes will implicitly send messages like #to_str or #to_ary to objects they are given, in order to ensure they are working with the expected type.

This documentation will help programmers identify which methods are needed in their classes in order that they 'quack' like Ruby Core classes such as File (e.g., by providing a #to_path method).

In this case I would add documentation and perhaps an example about this to http://ruby-doc.org/core-2.3.3/File.html.

ruby repo outdated

The ruby repository fork in this org is quite old, currently 7156 commits behind master.

The how-to instructions mention how to clone this repository to add docs patches.

If a user follows those instructions, they're perhaps wasting effort: the upstream may have moved on.

Adding Aliased as to detect and find enumerables

As in the Array ruby docs, identical methods are listed as "Alias for: method name". For example in the Array docs there are two identical methods: length, and size. It is indicated that in both methods that they Alias for: length and Alias for: size. This is very helpful to the Dev in that it is immediately known that both methods act the exact same way when used; more over, that either method can be used safely knowing the outcome, just adding more linguistic control over code read.

'Supplemental notes' sections break fragment identifier navigation

'Supplemental notes' sections break fragment identifier navigation

There are 'Supplemental notes' sections on some documentation pages that load a second or two after the rest of the page loads. When they appear, they bump down all the content below them. This causes links that include a fragment identifier for a particular section, like documentation for a method, to become much less usable, because when the page finishes loading the section has moved down the page, possibly even out of view.

For example if you visit http://ruby-doc.org/core-2.1.5/String.html#method-i-to_i and wait for the page to load, the to_i method documentation will initially be at the top of the window, but when the supplemental notes sections subsequently load, the to_i documentation jumps down the page out of view.

I haven't been able to find any supplemental notes sections for Ruby 2.2.4. Have supplemental notes been removed from newer versions of the documentation?

If not, is it possible to have the supplemental notes load along with the rest of the page, or somehow realign the window with the correct section after the supplemental notes load?

Working on DEBUGGER__ Class

Was great to meet @zzak at BrightonRuby Conf, thanks for the inspiration to start working on documenting Ruby.

I've run rdoc for a list of undocumented areas and I've picked the DEBUGGER__ Class. If there are any reasons why DEBUGGER__ is a bad choice please let me know. Otherwise a PR should follow soon :)

IO.Select use on OpenSSL::SSL::SSLSocket

I've been looking for ways to make some of the existing documentation easier to read. Looking through io.c, I noticed the comment for IO.select currently says

Especially, the combination of nonblocking methods and
IO.select is preferred for IO like
objects such as OpenSSL::SSL::SSLSocket.

It then goes on to explain several reasons why that could be a bad idea. Is it really preferred as long as you account for those potential problems, or did someone leave out a word when writing this documentation?

Miss-match quote pairs

There some miss-match quote pairs in some class like, Time Class, and few others, example: (``Sunday'') (start with double back-tick and end with double single quotes.

i am new to the ruby

what are the diffrence between fetch,at,slice and index metods in ruby? pleae anyone explain me with example.
and also help me to strong in the ruby on rails.

Documenting io/nonblock

io/nonblock in the standard library looks undocumented so far. Looking at nonblock.c and playing with it in IRB shows it defines 3 methods on IO objects when it's required. Is this available for me to work on?

Documentation for Debug

I want to add documentation for Debug, which is currently lacking. I'll follow general recommendations for submitting patches, etc.

Example Edit required in Marshal.rb

https://ruby-doc.org/core-2.6.1/Marshal.html#top

This example:

class MyObj
def initialize name, version, data
@name = name
@Version = version
@DaTa = data
end

def _dump level
[@name, @Version].join ':'
end

def self._load args
new(*args.split(':'))
end
end

Should be like this:

class MyObj
def initialize name, version, data
@name = name
@Version = version
@DaTa = data
end

def _dump level
[@name, @Version,@DaTa].join ':'
end

def self._load args
new(*args.split(':'))
end
end

Documenting lib/debug.rb

Hey y'all, so I wanted to try submitting my first patch to Ruby and I thought documentation would be a good way to start.

For now I am trying to document #thread_list_all().

I hope to document more of the class but I wanted to start small to get the process down.

Overriding Precedence in Expressions

As near as I can tell, using parentheses to override precedence in expressions isn't mentioned anywhere in the docs. I think this maybe belongs on the precedence.rdoc page; I'm willing to write a patch for this, but since this would be my first, I wanted to check with the documentation crew that the documentation truly isn't there.

Example code for YAMLTree is broken for Ruby 2.5+

What is the problem?

On this page, It shows the following example code:

builder = Psych::Visitors::YAMLTree.new
builder << { :foo => 'bar' }
builder.tree # => #<Psych::Nodes::Stream .. }

This seems to work up until 2.4.0. In 2.5.0+, it seems that the optional parameters for new became mandatory:

pry(main)> builder = Psych::Visitors::YAMLTree.new
ArgumentError: wrong number of arguments (given 0, expected 3)

What was the expected behaviour?

I expected that the sample code on a docs page should be valid for the particular version of Ruby I'm looking at.

If you have an idea for a potential fix, list it here

IDK

Documenting aliases

When I search for some method on ruby-doc, I miss an information about aliases for a method, like on Enumerable module: select is an alias to find_all, but I can't know that when I read the documentation (except when I click "toggle source" and realize that both show the same code).
Is there a solution to show that information (other than adding on find_all doc something like "select" and "find_all" are aliases)?

Hash: Document quoted-string-followed-by-colon syntax for Symbol keys in Hash literals

In Ruby >= 2.2, the following Hash literals are equivalent:

  1. { :my_key => 5 }

    (Symbol literal used as key in the generic hash literal notation that'd work for non-Symbol keys, too.)
  2. { my_key: 5 }

    (Symbol-key-specific "JavaScript-like" new notation introduced in Ruby 1.9)
  3. { :"my_key" => 5 }

    (Same as (1.), just with a different notation for the Symbol literal. Allows string interpolation inside the symbol name.)
  4. { :'my_key' => 5 }

    (Same as (1.), just with a different notation for the Symbol literal. No string interpolation.)
  5. { "my_key": 5 }

    (Introduced by feature request #4276 in Ruby 2.2. Allows string interpolation inside the symbol name.)
  6. { 'my_key': 5 }

    (Probably also introduced by feature request ruby#4276. No string interpolation.)

While (1.) & (2.) are documented on http://ruby-doc.org/core-2.2.2/Hash.html and (3.) & (4.) follow from (1.) when plugging in the alternate Symbol literal notations, (5.) & (6.) seem to be undocumented yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.