optparse_ex 0.0.3 → 0.0.5

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 772f071b073c1457682daa583ae656828c1241d3f01273ed97544d07124bcd8d
4
+ data.tar.gz: eafbfe667c69fc41dfef30f96a426990142ffdbce3e7a776c05849276bcc0ef2
5
+ SHA512:
6
+ metadata.gz: d74d21fd69d014330afcbdef0233f77dd0ced6099e0af53901c36650a879fafe24945cb42605f5e71b688c1c3d398a7ebad8d70cfe565d9e5d3a1cdb5e848daa
7
+ data.tar.gz: bdc318bfb1dda4b12a6682f6a60bbc2b2f2b8c3ba8be6659b6b787f701618405d07b8843d98310fef7ec744acd1639444007e2bf77b199eb25a6225f0e4fb40b
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in optparse_ex.gemspec
4
+ gemspec
5
+
6
+ ruby '>= 3.0'
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Masa
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # OptparseEx
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ gem 'optparse_ex'
8
+
9
+ And then execute:
10
+
11
+ $ bundle
12
+
13
+ Or install it yourself as:
14
+
15
+ $ gem install optparse_ex
16
+
17
+ ## Usage
18
+
19
+ TODO
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.pattern = "test/**/*_test.rb"
6
+ end
@@ -0,0 +1,3 @@
1
+ module OptparseEx
2
+ VERSION = "0.0.5"
3
+ end
@@ -0,0 +1,35 @@
1
+ require "optparse"
2
+
3
+ module OptparseEx
4
+ class ::OptionParser
5
+ attr_reader :p
6
+ alias :_on :on
7
+
8
+ def on(attr, *args, default: nil, &block)
9
+ if attr.is_a?(Symbol)
10
+ self.class.class_eval do
11
+ unless method_defined?(attr)
12
+ attr_accessor attr
13
+ else
14
+ raise "Method #{attr} is already defined in OptionParser class"
15
+ end
16
+ end
17
+
18
+ self.send("#{attr}=", default) if default
19
+
20
+ unless args.first.to_s =~ /^\-/
21
+ self.send("#{attr}=", args.shift)
22
+ end
23
+
24
+ _on(*args) do |i|
25
+ self.send("#{attr}=", i)
26
+ block.call(i) if block
27
+ end
28
+ else
29
+ args.unshift attr
30
+ _on(*args, block)
31
+ end
32
+ end
33
+ end
34
+ end
35
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "optparse_ex/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "optparse_ex"
8
+ spec.version = OptparseEx::VERSION
9
+ spec.authors = ["Masa"]
10
+ spec.email = ["masaomi.hatakeyama@gmail.com"]
11
+ spec.description = %q{This extension allows us to use optparse library more simply to add accessor method.}
12
+ spec.summary = %q{A small extension of optparse library.}
13
+ spec.homepage = "https://github.com/masa/optparse_ex"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "minitest"
23
+ end
metadata CHANGED
@@ -1,46 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optparse_ex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Masa
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-06-10 00:00:00.000000000 Z
11
+ date: 2025-02-19 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: '1.3'
19
+ version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: '1.3'
26
+ version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
36
46
  - !ruby/object:Gem::Version
37
47
  version: '0'
38
48
  type: :development
39
49
  prerelease: false
40
50
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
51
  requirements:
43
- - - ! '>='
52
+ - - ">="
44
53
  - !ruby/object:Gem::Version
45
54
  version: '0'
46
55
  description: This extension allows us to use optparse library more simply to add accessor
@@ -50,30 +59,36 @@ email:
50
59
  executables: []
51
60
  extensions: []
52
61
  extra_rdoc_files: []
53
- files: []
54
- homepage: ''
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/optparse_ex.rb
69
+ - lib/optparse_ex/version.rb
70
+ - optparse_ex.gemspec
71
+ homepage: https://github.com/masa/optparse_ex
55
72
  licenses:
56
73
  - MIT
57
- post_install_message:
74
+ metadata: {}
75
+ post_install_message:
58
76
  rdoc_options: []
59
77
  require_paths:
60
78
  - lib
61
79
  required_ruby_version: !ruby/object:Gem::Requirement
62
- none: false
63
80
  requirements:
64
- - - ! '>='
81
+ - - ">="
65
82
  - !ruby/object:Gem::Version
66
83
  version: '0'
67
84
  required_rubygems_version: !ruby/object:Gem::Requirement
68
- none: false
69
85
  requirements:
70
- - - ! '>='
86
+ - - ">="
71
87
  - !ruby/object:Gem::Version
72
88
  version: '0'
73
89
  requirements: []
74
- rubyforge_project:
75
- rubygems_version: 1.8.24
76
- signing_key:
77
- specification_version: 3
90
+ rubygems_version: 3.3.26
91
+ signing_key:
92
+ specification_version: 4
78
93
  summary: A small extension of optparse library.
79
94
  test_files: []