opener-core 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/opener/core.rb +1 -1
- data/lib/opener/core/language_error.rb +23 -0
- data/lib/opener/core/version.rb +1 -1
- metadata +3 -3
- data/lib/opener/core/opt_parser.rb +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae866565827f5fcdd91168b27ffce5f1e0ea3121
|
4
|
+
data.tar.gz: 0e6537c4e0c0ab0510c7487aec66c5c8c5c48de3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6ec81346c1409a8ac31a02598eebdada6eec3b1a3a76e6d46ad434b05cb23c6d3db26ed94de43f01eab537b5daf634defbb9d250ad09ecebcc59fb98bfb5724
|
7
|
+
data.tar.gz: 63dfe4fed71d80a52b6c941c6cf58a5148ab6554ccc004356efc2e3b4b9edc03bcb1f8e8facebc22cd063f95f4b6a39edc7dfb4bde5b90267d518c8a659bf3a3
|
data/lib/opener/core.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Opener
|
2
|
+
module Core
|
3
|
+
##
|
4
|
+
# Error class that can be used by components whenever they encounter an
|
5
|
+
# unsupported language.
|
6
|
+
#
|
7
|
+
# @!attribute [r] language
|
8
|
+
# @return [String]
|
9
|
+
#
|
10
|
+
class UnsupportedLanguageError < StandardError
|
11
|
+
attr_reader :language
|
12
|
+
|
13
|
+
##
|
14
|
+
# @param [String] language
|
15
|
+
#
|
16
|
+
def initialize(language)
|
17
|
+
@language = language
|
18
|
+
|
19
|
+
super("The language #{language.inspect} is not supported")
|
20
|
+
end
|
21
|
+
end # UnsupportedLanguageError
|
22
|
+
end # Core
|
23
|
+
end # Opener
|
data/lib/opener/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opener-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- development@olery.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|
@@ -103,7 +103,7 @@ files:
|
|
103
103
|
- LICENSE.txt
|
104
104
|
- README.md
|
105
105
|
- lib/opener/core.rb
|
106
|
-
- lib/opener/core/
|
106
|
+
- lib/opener/core/language_error.rb
|
107
107
|
- lib/opener/core/resource_switcher.rb
|
108
108
|
- lib/opener/core/syslog.rb
|
109
109
|
- lib/opener/core/version.rb
|
@@ -1,60 +0,0 @@
|
|
1
|
-
module Opener
|
2
|
-
module Core
|
3
|
-
class OptParser
|
4
|
-
attr_accessor :option_parser, :options
|
5
|
-
|
6
|
-
def initialize(&block)
|
7
|
-
@options = {}
|
8
|
-
@option_parser = construct_option_parser(options, &block)
|
9
|
-
end
|
10
|
-
|
11
|
-
def parse(args)
|
12
|
-
process(:parse, args)
|
13
|
-
end
|
14
|
-
|
15
|
-
def parse!(args)
|
16
|
-
process(:parse!, args)
|
17
|
-
end
|
18
|
-
|
19
|
-
def pre_parse!(args)
|
20
|
-
delete_double_dash = false
|
21
|
-
process(:parse!, args, delete_double_dash)
|
22
|
-
end
|
23
|
-
|
24
|
-
def pre_parse(args)
|
25
|
-
delete_double_dash = false
|
26
|
-
process(:parse, args, delete_double_dash)
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.parse(args)
|
30
|
-
new.parse(args)
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.parse!(args)
|
34
|
-
new.parse!(args)
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.pre_parse!(args)
|
38
|
-
new.pre_parse!(args)
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.pre_parse(args)
|
42
|
-
new.pre_parse(args)
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def process(call, args, delete_double_dash=true)
|
48
|
-
args.delete("--") if delete_double_dash
|
49
|
-
option_parser.send(call, args)
|
50
|
-
return options
|
51
|
-
end
|
52
|
-
|
53
|
-
def construct_option_parser(options, &block)
|
54
|
-
raise NotImplementedError
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|