rogerdpack-sane 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/sane.rb +38 -32
  2. metadata +1 -1
data/lib/sane.rb CHANGED
@@ -20,37 +20,43 @@ class File
20
20
  end
21
21
 
22
22
 
23
- # a method like puts but all on one line--very much like java's println, quite useful
24
- def println *args
25
- print *args
26
- puts
27
- end
28
23
 
29
24
  class Object
30
25
 
31
- # a helper for collection.include?
32
- def in? collection
33
- collection.include?(self)
34
- end unless respond_to? :in
35
-
36
- # ex: assert(some statement)
37
- # or
38
- # assert(some statement, "some helper string")
39
- def assert(should_be_true, string = nil)
40
- if(!should_be_true)
41
- raise "assertion failed #{string}"
42
- end
43
- end unless respond_to? :assert
26
+ # a helper for collection.include?
27
+ def in? collection
28
+ collection.include?(self)
29
+ end unless respond_to? :in
30
+
31
+ # ex: assert(some statement)
32
+ # or
33
+ # assert(some statement, "some helper string")
34
+ def assert(should_be_true, string = nil)
35
+ if(!should_be_true)
36
+ raise "assertion failed #{string}"
37
+ end
38
+ end unless respond_to? :assert
39
+
40
+ # helper to bring up a debugger
41
+ # for this to work in 1.9, please follow directions: http://wiki.github.com/mark-moseley/ruby-debug
42
+ # for 1.8, run gem install ruby-debug
43
+ def _dbg
44
+ require 'rubygems'
45
+ require 'ruby-debug'
46
+ debugger
47
+ end
44
48
 
45
- # helper to bring up a debugger
46
- # for this to work in 1.9, please follow directions: http://wiki.github.com/mark-moseley/ruby-debug
47
- # for 1.8, run gem install ruby-debug
48
- def _dbg
49
- require 'rubygems'
50
- require 'ruby-debug'
51
- debugger
52
- end
49
+ # a method like puts but all on one line--very much like java's println, quite useful
50
+ def println *args
51
+ print *args
52
+ puts
53
+ end
53
54
 
55
+ def aliaz hash
56
+ hash.each_pair {|new, old|
57
+ alias_method new, old
58
+ }
59
+ end
54
60
  end
55
61
 
56
62
  if RUBY_VERSION < '1.9'
@@ -60,10 +66,10 @@ end
60
66
  # taken from http://oldrcrs.rubypal.com/rcr/show/309
61
67
 
62
68
  module Kernel
63
- BASE_DIR = Dir.getwd
64
- def __DIR__
65
- dir = (/^(.+)?:\d+/ =~ caller[0]) ? File.expand_path(File.dirname($1), BASE_DIR) : nil
66
- dir += '/' if dir
67
- dir
68
- end unless defined?(__DIR__)
69
+ BASE_DIR = Dir.getwd
70
+ def __DIR__
71
+ dir = (/^(.+)?:\d+/ =~ caller[0]) ? File.expand_path(File.dirname($1), BASE_DIR) : nil
72
+ dir += '/' if dir
73
+ dir
74
+ end unless defined?(__DIR__)
69
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rogerdpack-sane
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger PacK