rprogram 0.1.0 → 0.1.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.
- data/History.txt +13 -0
- data/lib/rprogram/option.rb +11 -0
- data/lib/rprogram/version.rb +1 -1
- data/lib/rprogram.rb +3 -0
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
== 0.1.1 / 2008-01-18
|
2
|
+
|
3
|
+
* Added support for the Option argument separators.
|
4
|
+
|
5
|
+
#
|
6
|
+
# Creates arguments of the form:
|
7
|
+
#
|
8
|
+
# ["-opts","value1:value2:value3"]
|
9
|
+
#
|
10
|
+
long_option :flag => '-opts', :separator => ':'
|
11
|
+
|
12
|
+
* Fixed lib/rprogram.rb file.
|
13
|
+
|
1
14
|
== 0.1.0 / 2008-01-17
|
2
15
|
|
3
16
|
* Removed redundent methods in Program:
|
data/lib/rprogram/option.rb
CHANGED
@@ -10,6 +10,9 @@ module RProgram
|
|
10
10
|
# Can the option be specified multiple times
|
11
11
|
attr_reader :multiple
|
12
12
|
|
13
|
+
# Argument separator
|
14
|
+
attr_reader :separator
|
15
|
+
|
13
16
|
#
|
14
17
|
# Creates a new Option object with the specified _options_. If a _block_
|
15
18
|
# is given it will be used for the custom formating of the option. If a
|
@@ -22,12 +25,16 @@ module RProgram
|
|
22
25
|
# Defaults to +falue+, if not given.
|
23
26
|
# <tt>:multuple</tt>:: Implies the option maybe given an Array of
|
24
27
|
# values. Defaults to +false+, if not given.
|
28
|
+
# <tt>:separator</tt>:: The separator to use for formating multiple
|
29
|
+
# arguments into one +String+. Cannot be used
|
30
|
+
# with +:multiple+.
|
25
31
|
#
|
26
32
|
def initialize(options={},&block)
|
27
33
|
@flag = options[:flag]
|
28
34
|
|
29
35
|
@equals = options[:equals] || false
|
30
36
|
@multiple = options[:multiple] || false
|
37
|
+
@separator = options[:separator]
|
31
38
|
|
32
39
|
@formating = block
|
33
40
|
end
|
@@ -52,6 +59,10 @@ module RProgram
|
|
52
59
|
value.each { |arg| args += format(arg) }
|
53
60
|
return args
|
54
61
|
else
|
62
|
+
if (value.kind_of?(Array) && @separator)
|
63
|
+
value = value.join(@separator)
|
64
|
+
end
|
65
|
+
|
55
66
|
return format(value)
|
56
67
|
end
|
57
68
|
end
|
data/lib/rprogram/version.rb
CHANGED
data/lib/rprogram.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rprogram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Postmodern Modulus III
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-01-
|
12
|
+
date: 2008-01-18 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|