option_list 1.1.3 → 1.1.4
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 +4 -4
- data/CODE_OF_CONDUCT.md +49 -0
- data/README.md +54 -36
- data/lib/option_list/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2650da4a37bd70ae725edff131f55737c18294f8
|
4
|
+
data.tar.gz: 5839f281fcbd14e41f30f09df222add47661943a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3476398579ac52edcf8b104aa3830f84d30d0a383d2ea109e73789db042d02dd7989b62d1d18d1c39279845f593d2b1a75910433d75c5d2cbc2a6dd447e547aa
|
7
|
+
data.tar.gz: 411ac7eb8e11b4caa050a2e422b9cc08128903dfe447091970ab008d7ab54e87175a23cd4ab61707a4813df3fdf8a72f8070b8a7debaa4d93d0bd3e50f00a473
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at peter.c.camilleri@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/README.md
CHANGED
@@ -1,14 +1,23 @@
|
|
1
|
-
#
|
1
|
+
# OptionList
|
2
2
|
|
3
|
-
This gem
|
4
|
-
tedious and something
|
3
|
+
This gem addresses the fact that parameter validation is long and
|
4
|
+
tedious and something needs to be done about that. This gem implements
|
5
5
|
the idea that parameters be described separately and validated in a
|
6
6
|
single line of client method code.
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
Most of what this gem does has been subsumed by the Ruby Language itself,
|
9
|
+
starting with version 1.9 and further with versions 2.0 and beyond.
|
10
|
+
|
11
|
+
Finally, I'd like to add a personal note about this code. This was my first
|
12
|
+
attempt at creating a gem. As such there is very much a newbie vibe to the
|
13
|
+
code. I hope you can chalk this up to just a part of the learning process.
|
14
|
+
None the less, if there are improvements that you (the reader) could suggest,
|
15
|
+
I'd really appreciate hearing about them.
|
16
|
+
|
17
|
+
Thanks in advance, Peter.
|
18
|
+
|
19
|
+
|
20
|
+
## Installation
|
12
21
|
|
13
22
|
Add this line to your application's Gemfile:
|
14
23
|
|
@@ -22,44 +31,53 @@ Or install it yourself as:
|
|
22
31
|
|
23
32
|
$ gem install option_list
|
24
33
|
|
34
|
+
The options_list gem is at: ( https://rubygems.org/gems/options_list )
|
35
|
+
|
25
36
|
## Usage
|
26
37
|
|
27
|
-
The use of option_list
|
38
|
+
The use of option_list occurs in three phases: Describing the Parameters,
|
28
39
|
Passing in Parameters and Validating/Accessing the Parameters. This can be
|
29
40
|
seen in the following example:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
41
|
+
```ruby
|
42
|
+
module ReadLine
|
43
|
+
#Create the parameter specification (simplified for brevity)
|
44
|
+
@spec = OptionList.new([:buffer, :history, :no_history], {:depth => 50}) do |options|
|
45
|
+
fail "Depth must be an integer" unless options.depth.is_a(Integer)
|
46
|
+
fail "Depth must be positive" if options.depth < 1
|
47
|
+
end
|
48
|
+
|
49
|
+
class << self
|
50
|
+
attr_reader :spec
|
51
|
+
end
|
52
|
+
|
53
|
+
def read_line(prompt, *options)
|
54
|
+
@options = ReadLine.spec.select(options)
|
55
|
+
#Further code deleted for brevity.
|
56
|
+
#Somewhere along the line it records the last line.
|
57
|
+
buffer_line(current_line)
|
58
|
+
current_line
|
59
|
+
end
|
60
|
+
|
61
|
+
def buffer_line(line)
|
62
|
+
@line_buffer << line if @options.history?
|
63
|
+
@line_buffer.delete_at(0) if @line_buffer.length > @options.depth
|
64
|
+
end
|
65
|
+
end
|
66
|
+
```
|
56
67
|
The option_list gem is described in the The option_list User's Guide
|
57
|
-
which covers version 1.1.1 which has no material change from 1.1.
|
68
|
+
which covers version 1.1.1 which has no material change from 1.1.3
|
58
69
|
|
59
70
|
## Contributing
|
60
71
|
|
61
|
-
|
72
|
+
#### Plan A
|
73
|
+
|
74
|
+
1. Fork it ( https://github.com/PeterCamilleri/option_list/fork )
|
62
75
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
63
76
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
64
77
|
4. Push to the branch (`git push origin my-new-feature`)
|
65
78
|
5. Create new Pull Request
|
79
|
+
|
80
|
+
#### Plan B
|
81
|
+
|
82
|
+
Go to the GitHub repository and raise an issue calling attention to some
|
83
|
+
aspect that could use some TLC or a suggestion or an idea.
|
data/lib/option_list/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: option_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -102,6 +102,7 @@ extra_rdoc_files:
|
|
102
102
|
- license.txt
|
103
103
|
files:
|
104
104
|
- ".gitignore"
|
105
|
+
- CODE_OF_CONDUCT.md
|
105
106
|
- Gemfile
|
106
107
|
- README.md
|
107
108
|
- docs/OL_UG.odt
|
@@ -140,3 +141,4 @@ signing_key:
|
|
140
141
|
specification_version: 4
|
141
142
|
summary: Flexible, Easy Function Parameters with Validation.
|
142
143
|
test_files: []
|
144
|
+
has_rdoc: true
|