Skip to content

Ruby Blender

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

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3643

Warning: Invalid argument supplied for foreach() in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3643

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3651

Warning: Invalid argument supplied for foreach() in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3651

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3654

Warning: Invalid argument supplied for foreach() in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3654

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 1925

Warning: Invalid argument supplied for foreach() in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 1925

Warning: Invalid argument supplied for foreach() in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 2290

Warning: implode() [function.implode]: Argument must be an array in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3242

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3265

Warning: Invalid argument supplied for foreach() in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3265

Warning: Invalid argument supplied for foreach() in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3306

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3357

Warning: Invalid argument supplied for foreach() in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3357

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3502

Warning: Invalid argument supplied for foreach() in /home/aetheric/public_html/blender/wp-content/plugins/devformatter/geshi/geshi.php on line 3502

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

  |  copy code |? 
01
02
# I am including gems in my irb session.  Therefore, the next require
03
require 'rubygems'
04
 
05
# wirble is a wonderful gem which add nice features to irb
06
require 'wirble'
07
 
08
# Dr. Nic's useful helper gem.  It makes it so you can say:
09
#   foo.map_by_bar
10
# instead of having to say:
11
#   foo.map{|f| f.bar}
12
# more to the point you can do
13
#   people.map_by_first_and_last
14
# instead of
15
#   people.map{|p| [p.first, p.last]}
16
require 'map_by_method'
17
 
18
# what_methods is a way to see which methods, when performed on an object, return a particular value:
19
# >> "hi".what? 'h'
20
# "hi".chop! == "h"
21
# "hi".chop == "h"
22
# => ["chop!", "chop"]
23
require 'what_methods'
24
 
25
# pretty print --> provides a "pretty" view of an object
26
require 'pp'
27
 
28
# auto indent irb; it's useful for when you're just experimenting
29
IRB.conf[:AUTO_INDENT]=true
30
 
31
# start wirble (with color)
32
Wirble.init
33
#Wirble.colorize
34
 
35
# What are the methods which belong only to an object, and not those inherited from Object
36
class Object
37
  def my_methods
38
    (self.methods - Object.methods).sort
39
  end
40
end
41
 
42
# strip html tags from a string
43
class String
44
  def strip_tags
45
    self.gsub(/<\S[^><]*>/,"")
46
  end
47
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