Skip to content

Ruby Blender

  • Blog
  • About
  • Archives
  • Log in
 
Less
More
Trim
Untrim
« Older
Home
Loading
Newer »
Archive for the 'configuration' Category
18Feb09 irbrc goodness
configuration programming ruby rubygems
2 Comments

Here’s my (current) .irbrc, with comments


# I am including gems in my irb session. Therefore, the next require
require 'rubygems'

# wirble is a wonderful gem which add nice features to irb
require 'wirble'

# Dr. Nic's useful helper gem. It makes it so you can say:
# foo.map_by_bar
# instead of having to say:
# foo.map{|f| f.bar}
# more to the point you can do
# people.map_by_first_and_last
# instead of
# people.map{|p| [p.first, p.last]}
require 'map_by_method'

# what_methods is a way to see which methods, when performed on an object, return a particular value:
# >> "hi".what? 'h'
# "hi".chop! == "h"
# "hi".chop == "h"
# => ["chop!", "chop"]
require 'what_methods'

# pretty print --> provides a "pretty" view of an object
require 'pp'

# auto indent irb; it's useful for when you're just experimenting
IRB.conf[:AUTO_INDENT]=true

# start wirble (with color)
Wirble.init
#Wirble.colorize

# What are the methods which belong only to an object, and not those inherited from Object
class Object
def my_methods
(self.methods - Object.methods).sort
end
end

# strip html tags from a string
class String
def strip_tags
self.gsub(/<\S[^><]*>/,"")
end
end

I’ve shown mine. Show me yours?

Here are links to the referenced rubygems:

  • what_methods
  • map_by_method
  • wirble
Enhanced by Zemanta
 
Browse Archives »
  • administrivia (2)
  • configuration (1)
  • metaprogramming (1)
  • mini-saga (5)
  • programming (10)
  • rails (1)
  • ruby (15)
  • rubygems (2)
  • Uncategorized (1)
 

Recent Posts

  • Default values for Attributes
  • Arguments with Trollop
  • Database Paranoia — ActiveRecord Callbacks
  • Ruby Bindings and Scope
  • What’s #method_missing missing?

Search

Browse by Category

  • administrivia (2)
  • configuration (1)
  • metaprogramming (1)
  • mini-saga (5)
  • programming (10)
  • rails (1)
  • ruby (15)
  • rubygems (2)
  • Uncategorized (1)

Browse by Tag

  • ActiveRecord
  • binding
  • Command-line interface
  • gotcha
  • irb
  • irbc
  • Languages
  • Library
  • Local variable
  • metaprogramming
  • mini-saga
  • paradigm
  • philosophy
  • programming
  • rails
  • Recursion
  • ruby
  • rubygems
  • Ruby on Rails
  • scope
  • utilities

Browse by Month

  • September 2009 (1)
  • August 2009 (4)
  • April 2009 (1)
  • February 2009 (11)
 
 
  • Blog
  • About
  • Archives
  • Log in
 


Theme Design by Jay Kwong | Powered by WordPress and K2

 

Home Top Archives Entries FeedComments Feed