Skip to content

BertramScharpf/ruby-supplement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

= supplement 2.21  --  Useful Ruby enhancements


Some simple Ruby extensions.


== Author

Bertram Scharpf <software@bertram-scharpf.de>


== Motivation

The original motivation was my conviction that a language that has a
Numeric#nonzero? method induces a programming style that as well demands
for a String#notempty? method.



== Description

These are methods on standard classes that didn't manage to become part of
the Ruby interpreter. (Although, some did in the meantime.)

They are all very small, most of them have less than 15 lines of code.
So they would not be a weight in the Ruby interpreter but it is very
difficult to convince a majority that they belong there.

The methods won't be useful for everybody but some programmers may like
to make them part of their programming style.

If you like to get taunted, then go to the Ruby mailing list and propose
one of them to be included into the Ruby standard.



== Intention

In my own code I use quite often a method <code>String#notempty?</code>
that does almost the same as <code>Numeric#nonzero?</code>. Every
attempt proposing it for the Ruby standard implementation has failed;
the discussion evolves the same every time.

Now here it is where I can just point to.



== Contents (uncomplete)

  * String#notempty?
  * String#clear
  * String#head
  * String#tail
  * String#rest
  * String#start_with?
  * String#end_with?
  * Array#notempty?
  * Hash#notempty?
  * Struct.[]
  * Integer.roman
  * Date.easter
  * TCPServer/UNIXServer.accept with a code block
  * File system stats
  * Process.renice
  * Interval timer
  * LockedFile

About

Useful Ruby enhancements

Resources

License

Stars

Watchers

Forks

Packages

No packages published