rogerdpack-sane 0.0.7 → 0.0.8

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 +44 -34
  2. metadata +1 -1
data/lib/sane.rb CHANGED
@@ -1,38 +1,48 @@
1
- require 'require_all' # require_all, require_rel
2
- require_rel 'enumerable-extra' # for #map(:symbol)
3
-
4
- # a method like puts but all on one line--very much like java's println, quite useful
1
+ require 'require_all' # require_all, require_rel
2
+ require_rel 'enumerable-extra' # for #map(:symbol)
3
+
4
+ # a method like puts but all on one line--very much like java's println, quite useful
5
5
  def println *args
6
6
  print *args
7
7
  puts
8
8
  end
9
-
10
- class Object
11
-
12
- # a helper for collection.include?
13
- def in? collection
14
- collection.include?(self)
15
- end unless respond_to? :in
16
-
17
- # ex: assert(some statement)
18
- # or
19
- # assert(some statement, "some helper string")
20
- def assert(should_be_true, string = nil)
21
- if(!should_be_true)
22
- raise "assertion failed #{string}"
23
- end
24
- end unless respond_to? :assert
25
-
26
- # for this to work in 1.9, please follow directions: http://wiki.github.com/mark-moseley/ruby-debug
27
- # for 1.8, run gem install ruby-debug
28
- def _dbg
29
- require 'rubygems'
30
- require 'ruby-debug'
31
- debugger
32
- end
33
-
34
- end
35
-
36
- if RUBY_VERSION < '1.9'
37
- # TODO require 'unique_require' # require things in the right order, on 1.8.x
38
- end
9
+
10
+ class Object
11
+
12
+ # a helper for collection.include?
13
+ def in? collection
14
+ collection.include?(self)
15
+ end unless respond_to? :in
16
+
17
+ # ex: assert(some statement)
18
+ # or
19
+ # assert(some statement, "some helper string")
20
+ def assert(should_be_true, string = nil)
21
+ if(!should_be_true)
22
+ raise "assertion failed #{string}"
23
+ end
24
+ end unless respond_to? :assert
25
+
26
+ # for this to work in 1.9, please follow directions: http://wiki.github.com/mark-moseley/ruby-debug
27
+ # for 1.8, run gem install ruby-debug
28
+ def _dbg
29
+ require 'rubygems'
30
+ require 'ruby-debug'
31
+ debugger
32
+ end
33
+
34
+ end
35
+
36
+ if RUBY_VERSION < '1.9'
37
+ # TODO require 'unique_require' # require things in the right order, on 1.8.x
38
+ end
39
+
40
+ # taken from http://oldrcrs.rubypal.com/rcr/show/309
41
+ module Kernel
42
+ BASE_DIR = Dir.getwd
43
+ def __DIR__
44
+ dir = (/^(.+)?:\d+/ =~ caller[0]) ? File.expand_path(File.dirname($1), BASE_DIR) : nil
45
+ dir += '/' if dir
46
+ dir
47
+ end
48
+ 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.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger PacK