rogerdpack-sane 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README +22 -0
  2. data/lib/sane.rb +38 -0
  3. metadata +56 -0
data/README ADDED
@@ -0,0 +1,22 @@
1
+ Collection of utilities to make ruby more user friendly.
2
+
3
+ Currently:
4
+
5
+ require_rel glob
6
+ * require a file relative to the current, i.e.
7
+ require_rel 'lib/filename'
8
+
9
+ Object#in?
10
+ 3.in? [1,2,3]
11
+ => true
12
+
13
+ println
14
+ like print, but with a carriage return at the end:
15
+ println 1,2,3
16
+ (prints 123\n)
17
+
18
+ enumerable-extra
19
+ #new enumerable #map
20
+ [1,2,3].map(:to_s) # applies it automatically! far less ugly than [1,2,3].map &:to_s
21
+
22
+ Don't leave home without these!
data/lib/sane.rb ADDED
@@ -0,0 +1,38 @@
1
+
2
+ # currently accepts either a glob [something with * in it]
3
+ # or a filename
4
+ def require_rel glob # we don't allow for requiring directories currently :)
5
+ dir = File.dirname(caller[0]) + '/'
6
+ if glob.include? '*'
7
+ files = Dir[dir + glob]
8
+ else
9
+ files = [dir + glob]
10
+ end
11
+ for file in files
12
+ if(!File.exist?(file) && File.exist?(file + '.rb'))
13
+ require file + '.rb'
14
+ else
15
+ require file
16
+ end
17
+ end
18
+ end
19
+
20
+ def println *args
21
+ print *args
22
+ puts
23
+ end
24
+
25
+ =begin rdoc
26
+
27
+ doctest: loads from subdir with a full name
28
+ >> dir = Dir.pwd
29
+ >> Dir.chdir('..') do; require dir + "/test_sane/load"; end
30
+ >> $here
31
+ => 1
32
+
33
+ doctest: Also, like a normal require, you can leave off the .rb suffix
34
+ >> Dir.chdir('..') do; require dir + "/test_sane/load2"; end
35
+ >> $here2
36
+ => 1
37
+
38
+ =end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rogerdpack-sane
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Roger PacK
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-02 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Helper methods for ruby to make it easier to work with
17
+ email:
18
+ - rogerdpack@gmail.com
19
+ executables: []
20
+
21
+ extensions: []
22
+
23
+ extra_rdoc_files:
24
+ - README
25
+ files:
26
+ - README
27
+ - lib/sane.rb
28
+ has_rdoc: false
29
+ homepage:
30
+ post_install_message:
31
+ rdoc_options:
32
+ - --main
33
+ - README
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: "0"
41
+ version:
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ requirements: []
49
+
50
+ rubyforge_project:
51
+ rubygems_version: 1.2.0
52
+ signing_key:
53
+ specification_version: 2
54
+ summary: Helper methods for ruby to make it easier to work with
55
+ test_files: []
56
+