detagger 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/detagger.gemspec +5 -5
- data/lib/detagger.rb +11 -1
- data/spec/detagger_spec.rb +5 -0
- metadata +10 -8
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/detagger.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "detagger"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["christfo"]
|
12
|
-
s.date = "2012-03-
|
12
|
+
s.date = "2012-03-21"
|
13
13
|
s.description = "This is intended to be used as a mixin, usualy with some kind of library that parses\n optional command line arguments. The feature here is that the options may contain tags ('example_tag:') that\n are not resolved until they are used. This means that one option may refer to another. An example might be:\n --stage /tmp/fred --logfile stage:/my.log \n which would later provide a method 'logfile' that would return '/tmp/fred/my.log' "
|
14
14
|
s.email = "chris.fordy@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
|
|
39
39
|
s.specification_version = 3
|
40
40
|
|
41
41
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
|
-
s.add_runtime_dependency(%q<facets>, ["
|
42
|
+
s.add_runtime_dependency(%q<facets>, ["= 2.9.2"])
|
43
43
|
s.add_development_dependency(%q<rspec>, [">= 2.8.0"])
|
44
44
|
s.add_development_dependency(%q<rdoc>, [">= 3.12"])
|
45
45
|
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
@@ -47,7 +47,7 @@ Gem::Specification.new do |s|
|
|
47
47
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
48
48
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
49
49
|
else
|
50
|
-
s.add_dependency(%q<facets>, ["
|
50
|
+
s.add_dependency(%q<facets>, ["= 2.9.2"])
|
51
51
|
s.add_dependency(%q<rspec>, [">= 2.8.0"])
|
52
52
|
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
53
53
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
@@ -56,7 +56,7 @@ Gem::Specification.new do |s|
|
|
56
56
|
s.add_dependency(%q<rcov>, [">= 0"])
|
57
57
|
end
|
58
58
|
else
|
59
|
-
s.add_dependency(%q<facets>, ["
|
59
|
+
s.add_dependency(%q<facets>, ["= 2.9.2"])
|
60
60
|
s.add_dependency(%q<rspec>, [">= 2.8.0"])
|
61
61
|
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
62
62
|
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
data/lib/detagger.rb
CHANGED
@@ -59,8 +59,12 @@ module Detagger
|
|
59
59
|
value
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
62
|
+
def split_method(method)
|
63
63
|
access, orig_method = *method.to_s.scan(/^(detag|raw)_(.+)$/).flatten
|
64
|
+
end
|
65
|
+
|
66
|
+
def method_missing( method, *args, &blk )
|
67
|
+
access, orig_method = split_method( method )
|
64
68
|
unless orig_method && target = [*detag_chain].find {|t| t.respond_to?( orig_method.to_sym )}
|
65
69
|
super(method,*args,&blk)
|
66
70
|
else
|
@@ -69,6 +73,12 @@ module Detagger
|
|
69
73
|
end
|
70
74
|
end
|
71
75
|
|
76
|
+
def respond_to?( method )
|
77
|
+
access, orig_method = split_method( method )
|
78
|
+
return true if orig_method && [*detag_chain].find {|t| t.respond_to?( orig_method.to_sym )}
|
79
|
+
super(method)
|
80
|
+
end
|
81
|
+
|
72
82
|
def unless_flag( flag, &blk )
|
73
83
|
unless self.send("detag_#{flag}")
|
74
84
|
yield blk
|
data/spec/detagger_spec.rb
CHANGED
@@ -36,6 +36,11 @@ describe Detagger do
|
|
36
36
|
@options. should respond_to :drill_down_ref
|
37
37
|
end
|
38
38
|
|
39
|
+
it "will respond to detag* and raw* mehtods" do
|
40
|
+
@options. should respond_to :detag_bob
|
41
|
+
@options. should respond_to :raw_bob
|
42
|
+
end
|
43
|
+
|
39
44
|
it "will give a value for inputs" do
|
40
45
|
@options.bob.should == "henry:"
|
41
46
|
@options.sue.should == "mary"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: detagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- christfo
|
@@ -15,19 +15,21 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-21 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :runtime
|
22
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
23
|
none: false
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - "="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
hash:
|
27
|
+
hash: 47
|
28
28
|
segments:
|
29
|
-
-
|
30
|
-
|
29
|
+
- 2
|
30
|
+
- 9
|
31
|
+
- 2
|
32
|
+
version: 2.9.2
|
31
33
|
version_requirements: *id001
|
32
34
|
name: facets
|
33
35
|
prerelease: false
|