barmcakes 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/arrghs.rb +21 -0
  2. data/lib/barmcakes.rb +2 -0
  3. data/lib/file.rb +9 -0
  4. metadata +48 -0
data/lib/arrghs.rb ADDED
@@ -0,0 +1,21 @@
1
+ #Parses command line arguments
2
+ class Arrghs
3
+ attr_reader :args
4
+
5
+ def self.parse(arg_arr)
6
+ args = {}
7
+ arg_arr.each_with_index do |opt, i|
8
+ #$stderr.puts opt, i
9
+ if opt =~ /^-{1,1}[^-]/
10
+ opt = opt[1..-1]
11
+ val = true
12
+ val = arg_arr[i + 1] if arg_arr[i + 1] !~ /^-/
13
+ opt.split(//).each {|f| args[f.to_sym] = val}
14
+ elsif opt =~ /^-{2,2}/
15
+ opt = opt[2..-1]
16
+ args[opt.to_sym] = arg_arr[i + 1]
17
+ end
18
+ end
19
+ args
20
+ end
21
+ end
data/lib/barmcakes.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'arrghs'
2
+ require 'file'
data/lib/file.rb ADDED
@@ -0,0 +1,9 @@
1
+ class File
2
+
3
+ def each_except_comments(comment_char="#")
4
+ self.each do |line|
5
+ yield line unless line =~ /^#{comment_char}/
6
+ end
7
+ end
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: barmcakes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Dan MacLean
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-06-06 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Just really stuff that I cobbled together that I use. You probably don't
15
+ want this.
16
+ email: maclean.daniel@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/barmcakes.rb
22
+ - lib/arrghs.rb
23
+ - lib/file.rb
24
+ homepage: http://github.com/danmaclean
25
+ licenses: []
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 1.8.25
45
+ signing_key:
46
+ specification_version: 3
47
+ summary: Miscellenitudinal tools and hack classes
48
+ test_files: []