Giter Club home page Giter Club logo

ruby-standard-libraries's Introduction

Ruby Standard Libraries

Promote hidden gems in Ruby Stdlib.

Target version: Ruby 2.1.2.

Official Documentation links.

Where does Ruby Stadard Libraries live?

Table of Content

List alphabetically:

Abbrev

Usage

Abbrev#abbrev will return unique abbreviations for a given set of strings:

signature: abbrev(words, pattern = nil)

Example

> require 'abbrev'
=> true

> puts Abbrev.abbrev(['ruby'])
=> {"ruby"=>"ruby", "rub"=>"ruby", "ru"=>"ruby", "r"=>"ruby"}

Optional parameter pattern can be a Regexp or String.

Regexp: Will return result whose key contains given pattern:

> Abbrev.abbrev(%w[python perl], /yt/)
=> {"python"=>"python", "pytho"=>"python", "pyth"=>"python", "pyt"=>"python"}

String: Will return result whose key has prefix of pattern:

> Abbrev.abbrev(%w[python perl], 'yt')
=> {}

> Abbrev.abbrev(%w[python perl], 'pyt')
=> {"python"=>"python", "pytho"=>"python", "pyth"=>"python", "pyt"=>"python"}

English

Usage

Reference cryptic global variable with plain English.

Mappings

Without English With English Without English With English
$! $ERROR_INFO $> $DEFAULT_OUTPUT
$@ $ERROR_POSITION $< $DEFAULT_INPUT
$; $FS $$ $PID
$; $FIELD_SEPARATOR $$ $PROCESS_ID
$, $OFS $? $CHILD_STATUS
$, $OUTPUT_FIELD_SEPARATOR $~ $LAST_MATCH_INFO
$/ $RS $= $IGNORECASE
$/ $INPUT_RECORD_SEPARATOR $* $ARGV
$\ $ORS $& $MATCH
$\ $OUTPUT_RECORD_SEPARATOR `$`` $PREMATCH
$. $INPUT_LINE_NUMBER $โ€˜ $POSTMATCH
$. $NR $+ $LAST_PAREN_MATCH
$_ $LAST_READ_LINE

Example

require 'English'

$OUTPUT_FIELD_SEPARATOR = ' -- '
'waterbuffalo' =~ /buff/
print $LOADED_FEATURES, $POSTMATCH, $PID, "\n"

Forwardable

Usage

Example

OpenStruct

Usage

Example

Pathname

Usage

Example

Shellwords

Usage

Example

Singleton

Usage

Example

YAML::Store

Usage

Example

Questions? Suggestions?

Tell me!

How to Contribute?

Read CONTRIBUTING.

License

CC-BY-SA

Creative Commons Attribution-ShareAlike 4.0 International License.

Author

๐Ÿ’› ๐Ÿ’™ ๐Ÿ’œ โค๏ธ ๐Ÿ’š ๐Ÿ’“ ๐Ÿ’— ๐Ÿ’• ๐Ÿ’ž ๐Ÿ’˜ ๐Ÿ’– ๐Ÿ’• ๐Ÿ’› ๐Ÿ’œ ๐Ÿ’– ๐Ÿ’š ๐Ÿ’— โค๏ธ ๐Ÿ’˜ ๐Ÿ’“ ๐Ÿ’ž ๐Ÿ’™

Written with love by @juanitofatas ๐Ÿ˜Ž.

ruby-standard-libraries's People

Contributors

juanitofatas avatar

Stargazers

Tai An Su avatar

Watchers

James Cloos avatar  avatar

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.