argv 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce16e2a57d05846e959a4d559b2271a21702c39d
4
- data.tar.gz: 85391398a6202282ed7a96bb37afbe7d3110200b
3
+ metadata.gz: 0d1674c456132510816a46e17e273375a62b3af9
4
+ data.tar.gz: 1fc5186e5020df4394ebc0f1caa6a71c91bb47ea
5
5
  SHA512:
6
- metadata.gz: 2ca54e2613a500712d6a432baf3c5dfbffbf0a85398f7661a106713354906e33107278d4ba38b4823ba3f3669512967d9929bbcb4390862280c0d70f79359718
7
- data.tar.gz: 907e4c2fbc032c0f88d6121456f50a891c66ed37fd0e17b47e576439637db00f74bc169a33eaea3c63515c734d4e9e039aeabfc579fc8b4ff8fb8b1a7796a534
6
+ metadata.gz: e2c3aa823da8edcf2e22f2b624cc04bdc66782061c3ecc9f5a197d120bdd9a9b3200091ed4908d439e7f7dcfd86bd8b0d1dd94eeb31d8baf1ab0cbb15941e521
7
+ data.tar.gz: dec3f2ea6b21a2537bd27967077905dd9aa195dda3b988390c994cca57c91c37f7e7514813a0568f7f7dff48ce90a3256bc3038a04573d2207d95f92a4bbe6b4
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  ./pkg/*
2
- pkg
2
+ pkg
3
+ Gemfile.lock
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- argv (2.1.1)
4
+ argv (2.2.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.1
1
+ 2.2.0
@@ -1,36 +1,56 @@
1
1
  module ARGVEXT
2
- class << self
3
2
 
4
- @@help_msg_obj ||= []
5
- def add_help_msg msg,*keys
6
- raise unless msg.class <= String
7
- @@help_msg_obj.push [msg,keys]
8
- return nil
9
- end
3
+ module MemoryCore
4
+ class << self
10
5
 
11
- alias :add_help :add_help_msg
6
+ @@help_msg_obj ||= []
7
+ def add_help_msg msg,*keys
8
+ raise unless msg.class <= String
9
+ @@help_msg_obj.push [msg,keys]
10
+ return nil
11
+ end
12
12
 
13
- def help_msg
13
+ def help_msg
14
14
 
15
- helper_sym= [:helper,:help,:h]
16
- self.add_help_msg "This will show you the help msg (this)",*helper_sym
17
- unless ::ARGV.sym_flags.select{ |e| helper_sym.include?(e) }.empty?
15
+ helper_sym= [:helper,:help,:h]
16
+ self.add_help_msg "This will show you the help msg (this)",*helper_sym
17
+ unless ::ARGV.sym_flags.select{ |e| helper_sym.include?(e) }.empty?
18
18
 
19
- tmp_ary= []
20
- @@help_msg_obj.each{ |ary|
21
- tmp_ary.push(ary[0])
22
- ary[1].each{|e| tmp_ary.push( ( e.to_s.length == 1 ? "-#{e}" : "--#{e}" ) )}
23
- tmp_ary.push("")
24
- }
19
+ tmp_ary= []
20
+ @@help_msg_obj.each{ |ary|
21
+ tmp_ary.push(ary[0])
22
+ ary[1].each{|e| tmp_ary.push( ( e.to_s.length == 1 ? "-#{e}" : "--#{e}" ) )}
23
+ tmp_ary.push("")
24
+ }
25
25
 
26
- tmp_ary.each{ |element| element.include?('--') ? element.gsub!('--',"\t--") : element.gsub!('-',"\t -")}
27
- puts "",tmp_ary.join("\n"),""
28
- Process.exit!
26
+ tmp_ary.each{ |element| element.include?('--') ? element.gsub!('--',"\t--") : element.gsub!('-',"\t -")}
27
+ puts "",tmp_ary.join("\n"),""
28
+ Process.exit!
29
29
 
30
+ end
30
31
  end
32
+
33
+ end
34
+ end
35
+
36
+ module MemoryEXT
37
+
38
+ def add_help_msg msg,*keys
39
+ ::ARGVEXT::MemoryCore.add_help_msg msg,*keys
40
+ end
41
+
42
+ alias :add_help :add_help_msg
43
+
44
+ def help_msg
45
+ ::ARGVEXT::MemoryCore.help_msg
31
46
  end
32
47
 
33
48
  alias :show_help :help_msg
34
49
 
35
50
  end
36
- end
51
+
52
+ self.extend MemoryEXT
53
+
54
+ end
55
+
56
+ ARGV.__send__ :extend, ARGVEXT::MemoryEXT
@@ -1,7 +1,11 @@
1
1
  require "argv"
2
2
 
3
3
  #$ ruby sample/test.rb --test test this ok
4
- ARGVEXT.help_msg
4
+
5
+ # new help
6
+ ARGV.add_help "heeeelp meeeeee~~~",:no
7
+
8
+ ARGV.show_help
5
9
 
6
10
  puts "","original ARGV:",ARGV.inspect,""
7
11
 
@@ -23,4 +27,4 @@ puts "argv values without the tags:",ARGV.values.inspect,""
23
27
  puts "argv tags, \"keys\":",ARGV.keys.inspect,""
24
28
  # ["--test"]
25
29
 
26
- puts "symbolized flags:",ARGV.sym_flags.inspect,""
30
+ puts "symbolized flags:",ARGV.sym_flags.inspect,""
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: argv
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi