optparse-simple 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/optparse-simple.rb +7 -2
  2. metadata +1 -1
@@ -4,9 +4,9 @@ include REXML
4
4
 
5
5
  class OptParseSimple
6
6
 
7
- def initialize(s, args)
8
-
7
+ def initialize(s)
9
8
  super()
9
+
10
10
  if s[/^https?:\/\//] then # url
11
11
  buffer = Kernel.open(s, 'UserAgent' => 'Polyrex-Reader').read
12
12
  elsif s[/\</] # xml
@@ -17,6 +17,10 @@ class OptParseSimple
17
17
 
18
18
  @doc = Document.new(buffer)
19
19
 
20
+ end
21
+
22
+ def parse(args)
23
+
20
24
  @options = XPath.match(@doc.root, 'records/option[summary/switch!=""]')
21
25
 
22
26
  switches = @options.map do |option|
@@ -61,6 +65,7 @@ class OptParseSimple
61
65
  invalid_option = a2.detect {|x,y| x.nil? }.last
62
66
  raise "invalid option: %s not recognised" % invalid_option
63
67
  end
68
+ self
64
69
  end
65
70
 
66
71
  def to_h()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optparse-simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors: []
7
7