utility_belt 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -37,13 +37,13 @@ sudo gem install utility_belt
37
37
 
38
38
  == COMMUNITY EFFORT
39
39
 
40
- The majority of this code was written by other people and compiled, nicked, nabbed, herded, gathered, copied, or pilfered by me (Giles Bowkett). See copyright notice for the credits. A lot of this code comes from blogs. Check out the source code for numerous links to the original posts the code came from.
40
+ The majority of this code was written by other people and compiled, nicked, nabbed, herded, gathered, copied, or pilfered by me (Giles Bowkett). See copyright notice for the credits. A lot of this code comes from blogs. Check out the source code for numerous links to the original posts the code came from. Thanks also to Bob Hutchison, Avdi Grimm, Marcus Derencius, Markus Prinz, Ben Bleything, Reginald Braithwaite-Lee, and Robert Berger for bug fixes, new features, documentation, and bug reports.
41
41
 
42
42
  == SYNOPSIS
43
43
 
44
44
  Utility Belt gives you a ton of new options and techniques in IRB. (You may find yourself putting its language patches in actual projects as well.) The way to use Utility Belt is to edit, or create, your .irbrc file. This is analogous to a Unix .bashrc, .tcshrc, .profile, or similar file.
45
45
 
46
- (Windows users are probably out of luck here - sorry. There may be a solution, but I don't know what it is.)
46
+ Windows users have a couple options. The easiest is to define an environment variable called IRBRC and set it to the full path of your irbrc (e.g. "C:\Documents and Settings\<username>\_irbrc"). Presto, .irbrc for Windows. If you've already got HOME defined as an env var, you may be able to get away with just calling the file "irbrc". It's also technically possible on at least some versions of Windows to actually name your file .irbrc, you just have to get around the limitations imposed by Windows Explorer.
47
47
 
48
48
  Adding Utility Belt to your .irbrc is easy:
49
49
 
data/html/authorship.html CHANGED
@@ -7,7 +7,7 @@
7
7
  <meta name="keywords" content="ruby, giles bowkett, batman, utility belt, gem, attack of the killer tomatoes" />
8
8
  <meta name="author" content="Giles Bowkett / Original design: Andreas Viklund - http://andreasviklund.com/" />
9
9
  <link rel="stylesheet" type="text/css" href="andreas00.css" media="screen,projection" />
10
- <title>Utility Belt: Usage</title>
10
+ <title>Utility Belt: Authorship</title>
11
11
  </head>
12
12
 
13
13
  <body>
@@ -23,6 +23,7 @@
23
23
  <li><a href="index.html">Overview</a></li>
24
24
  <li><a href="usage.html">Usage</a></li>
25
25
  <li><a href="authorship.html">Authorship</a></li>
26
+ <li><a href="http://rubyforge.org/projects/utilitybelt/">RubyForge Project</a></li>
26
27
  </ul>
27
28
  </div>
28
29
 
@@ -30,7 +31,7 @@
30
31
  <h2>Copyright And Authorship</h2>
31
32
  <h3>COMMUNITY EFFORT</h3>
32
33
 
33
- <p>The majority of this code was written by other people and compiled, nicked, nabbed, herded, gathered, copied, or pilfered by me (Giles Bowkett). Check the links in the copyright notice for more detail.</p>
34
+ <p>The majority of this code was written by other people and compiled, nicked, nabbed, herded, gathered, copied, or pilfered by me (Giles Bowkett). Check the links in the copyright notice for more detail. Thanks also to Bob Hutchison, Avdi Grimm, Marcus Derencius, Markus Prinz, Ben Bleything, Reginald Braithwaite-Lee, and Robert Berger for bug fixes, new features, documentation, and bug reports.</p>
34
35
 
35
36
  <h3>LICENSE</h3>
36
37
 
data/html/index.html CHANGED
@@ -7,7 +7,7 @@
7
7
  <meta name="keywords" content="ruby, giles bowkett, batman, utility belt, gem, attack of the killer tomatoes" />
8
8
  <meta name="author" content="Giles Bowkett / Original design: Andreas Viklund - http://andreasviklund.com/" />
9
9
  <link rel="stylesheet" type="text/css" href="andreas00.css" media="screen,projection" />
10
- <title>Utility Belt: Usage</title>
10
+ <title>Utility Belt</title>
11
11
  </head>
12
12
 
13
13
  <body>
@@ -23,6 +23,7 @@
23
23
  <li><a href="index.html">Overview</a></li>
24
24
  <li><a href="usage.html">Usage</a></li>
25
25
  <li><a href="authorship.html">Authorship</a></li>
26
+ <li><a href="http://rubyforge.org/projects/utilitybelt/">RubyForge Project</a></li>
26
27
  </ul>
27
28
 
28
29
  </div>
data/html/usage.html CHANGED
@@ -23,6 +23,7 @@
23
23
  <li><a href="index.html">Overview</a></li>
24
24
  <li><a href="usage.html">Usage</a></li>
25
25
  <li><a href="authorship.html">Authorship</a></li>
26
+ <li><a href="http://rubyforge.org/projects/utilitybelt/">RubyForge Project</a></li>
26
27
  </ul>
27
28
 
28
29
  </div>
@@ -35,7 +36,7 @@
35
36
 
36
37
  <p>Utility Belt gives you a ton of new options and techniques in IRB. (You may find yourself putting its language patches in actual projects as well.) The way to use Utility Belt is to edit, or create, your .irbrc file. This is analogous to a Unix .bashrc, .tcshrc, .profile, or similar file.</p>
37
38
 
38
- <p>(Windows users are probably out of luck here - sorry. There may be a solution, but I don't know what it is.)</p>
39
+ <p>Windows users have a couple options. The easiest is to define an environment variable called IRBRC and set it to the full path of your irbrc (e.g. "C:\Documents and Settings\<username>\_irbrc"). Presto, .irbrc for Windows. If you've already got HOME defined as an env var, you may be able to get away with just calling the file "irbrc". It's also technically possible on at least some versions of Windows to actually name your file .irbrc, you just have to get around the limitations imposed by Windows Explorer.</p>
39
40
 
40
41
  <p>Adding Utility Belt to your .irbrc is easy:</p>
41
42
 
@@ -13,4 +13,6 @@ end
13
13
 
14
14
  # a quick note: the "google" command uses CGI.escape, but the URLs produced by CGI.escape
15
15
  # don't seem to succeed here, in practice. this may differ by OS and/or browser. Let me
16
- # know if you see something weird -- gilesb@gmail.com.
16
+ # know if you see something weird -- the Utility Belt mailing list is here:
17
+ #
18
+ # http://rubyforge.org/mailman/listinfo/utilitybelt-tinkering
data/lib/hash_math.rb ADDED
@@ -0,0 +1,13 @@
1
+ class Hash
2
+ alias :+ :merge
3
+ def -(thing_to_be_deleted)
4
+ if thing_to_be_deleted.is_a? Hash
5
+ thing_to_be_deleted.each do |key, value|
6
+ self.delete(key) if self[key] == value
7
+ end
8
+ elsif self.keys.include? thing_to_be_deleted
9
+ self.delete(thing_to_be_deleted)
10
+ end
11
+ self
12
+ end
13
+ end
data/lib/utility_belt.rb CHANGED
@@ -26,6 +26,7 @@ UTILITY_BELT_IRB_STARTUP_PROCS = {}
26
26
  interactive_editor
27
27
  string_to_proc
28
28
  symbol_to_proc
29
+ hash_math
29
30
  with}.each {|internal_library| require internal_library}
30
31
 
31
32
  # default: dark background
@@ -0,0 +1,16 @@
1
+ require "lib/hash_math"
2
+ describe "Hash math" do
3
+
4
+ it "should add hashes" do
5
+ ({:a => :b} + {:c => :d}).should == {:a => :b, :c => :d}
6
+ end
7
+
8
+ it "should subtract hashes" do
9
+ ({:a => :b, :c => :d} - {:c => :d}).should == {:a => :b}
10
+ end
11
+
12
+ it "should subtract key/value pairs by key" do
13
+ ({:a => :b, :c => :d} - :c).should == {:a => :b}
14
+ end
15
+
16
+ end
@@ -1,2 +1,3 @@
1
1
  # yeah, I know. I know! but you try to write specs for code which launches vi. most of this was
2
- # already written by the time I started tasting the BDD Kool-Aid.
2
+ # already written by the time I started tasting the BDD Kool-Aid. HOWEVER! any new patches are
3
+ # very welcome, but MUST be accompanied by a spec or an absolutely airtight reason why not.
data/utility_belt.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  SPEC = Gem::Specification.new do |s|
3
3
  s.name = "utility_belt"
4
- s.version = "1.0.4"
4
+ s.version = "1.0.5"
5
5
  s.author = "Giles Bowkett"
6
6
  s.email = "gilesb@gmail.com"
7
7
  s.homepage = "http://utilitybelt.rubyforge.org"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utility_belt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giles Bowkett
@@ -9,7 +9,7 @@ autorequire: utility_belt
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2007-12-12 00:00:00 -08:00
12
+ date: 2007-12-15 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -66,6 +66,7 @@ files:
66
66
  - lib
67
67
  - lib/amazon_upload_shortcut.rb
68
68
  - lib/command_history.rb
69
+ - lib/hash_math.rb
69
70
  - lib/interactive_editor.rb
70
71
  - lib/irb_options.rb
71
72
  - lib/irb_verbosity_control.rb
@@ -85,6 +86,7 @@ files:
85
86
  - Rakefile
86
87
  - README
87
88
  - test
89
+ - test/hash_math_spec.rb
88
90
  - test/language_greps_spec.rb
89
91
  - test/string_to_proc_spec.rb
90
92
  - test/utility_belt_spec.rb