mod_comm 0.1.0
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 +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +19 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +57 -0
- data/README.md +48 -0
- data/Rakefile +12 -0
- data/lib/mod_comm/version.rb +5 -0
- data/lib/mod_comm.rb +40 -0
- data/mod_comm.gemspec +38 -0
- data/sig/mod_comm.rbs +4 -0
- metadata +57 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cd0ea0ccd2d1b18991acbc314b528adc3340493b1e7640056011ae8e15df1580
|
4
|
+
data.tar.gz: 26235b0a0f5cb4285ee81bed7f2711973d05a8f0bdc9986ec7e3041f2d167b3e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 89773f6a9ed29b4e23506121eea041d726cbee420206b9234fc5c38b714f3f8094c0d137b58bfb3aa3781bca9e16eeb27cf89defe1383136d147a3eaa81511e0
|
7
|
+
data.tar.gz: 61d350aa7cca80de732287edb45930af986b3076c571761bdbcb11a65de3d5e0b5ff38f36fbc65421483647367a6a51ad370fd00bc4f47e30b4602c385919168
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.6
|
3
|
+
|
4
|
+
Style/StringLiterals:
|
5
|
+
Enabled: true
|
6
|
+
EnforcedStyle: double_quotes
|
7
|
+
|
8
|
+
Style/StringLiteralsInInterpolation:
|
9
|
+
Enabled: true
|
10
|
+
EnforcedStyle: double_quotes
|
11
|
+
|
12
|
+
Layout/LineLength:
|
13
|
+
Max: 120
|
14
|
+
|
15
|
+
Lint/UnusedMethodArgument:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Lint/UselessAssignment:
|
19
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mod_comm (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
diff-lcs (1.5.0)
|
11
|
+
json (2.6.3)
|
12
|
+
parallel (1.22.1)
|
13
|
+
parser (3.1.3.0)
|
14
|
+
ast (~> 2.4.1)
|
15
|
+
rainbow (3.1.1)
|
16
|
+
rake (13.0.6)
|
17
|
+
regexp_parser (2.6.1)
|
18
|
+
rexml (3.2.5)
|
19
|
+
rspec (3.12.0)
|
20
|
+
rspec-core (~> 3.12.0)
|
21
|
+
rspec-expectations (~> 3.12.0)
|
22
|
+
rspec-mocks (~> 3.12.0)
|
23
|
+
rspec-core (3.12.0)
|
24
|
+
rspec-support (~> 3.12.0)
|
25
|
+
rspec-expectations (3.12.1)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.12.0)
|
28
|
+
rspec-mocks (3.12.1)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.12.0)
|
31
|
+
rspec-support (3.12.0)
|
32
|
+
rubocop (1.41.1)
|
33
|
+
json (~> 2.3)
|
34
|
+
parallel (~> 1.10)
|
35
|
+
parser (>= 3.1.2.1)
|
36
|
+
rainbow (>= 2.2.2, < 4.0)
|
37
|
+
regexp_parser (>= 1.8, < 3.0)
|
38
|
+
rexml (>= 3.2.5, < 4.0)
|
39
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
40
|
+
ruby-progressbar (~> 1.7)
|
41
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
42
|
+
rubocop-ast (1.24.1)
|
43
|
+
parser (>= 3.1.1.0)
|
44
|
+
ruby-progressbar (1.11.0)
|
45
|
+
unicode-display_width (2.3.0)
|
46
|
+
|
47
|
+
PLATFORMS
|
48
|
+
x86_64-linux
|
49
|
+
|
50
|
+
DEPENDENCIES
|
51
|
+
mod_comm!
|
52
|
+
rake (~> 13.0)
|
53
|
+
rspec (~> 3.0)
|
54
|
+
rubocop (~> 1.21)
|
55
|
+
|
56
|
+
BUNDLED WITH
|
57
|
+
2.4.1
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# ModComm
|
2
|
+
|
3
|
+
> Private method set
|
4
|
+
|
5
|
+
Private methods for ruby module common use
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
|
11
|
+
$ bundle add mod_comm
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
$ gem install mod_comm
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
require "mod_comm"
|
21
|
+
|
22
|
+
class MyClass
|
23
|
+
extend ModComm
|
24
|
+
include ModComm
|
25
|
+
|
26
|
+
def run(*argv, opt_argv: [], **opts)
|
27
|
+
argv = _empty_false(argv) || _to_argv(opt_argv)
|
28
|
+
|
29
|
+
puts argv.join(" ")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
MyClass.ps(:MyClass) {}
|
34
|
+
m = MyClass.new
|
35
|
+
m.run("hello", "world")
|
36
|
+
m.run(opt_argv: %w[hello world])
|
37
|
+
m.run(opt_argv: "hello")
|
38
|
+
```
|
39
|
+
|
40
|
+
## Development
|
41
|
+
|
42
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
43
|
+
|
44
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/initdc/mod_comm.
|
data/Rakefile
ADDED
data/lib/mod_comm.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "mod_comm/version"
|
4
|
+
|
5
|
+
module ModComm
|
6
|
+
# ps(:a) {}
|
7
|
+
def ps(sym, &block)
|
8
|
+
print " #{sym}: "
|
9
|
+
p eval(sym.to_s, block.binding)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def _to_argv(any)
|
15
|
+
any.instance_of?(Array) ? any : [any]
|
16
|
+
end
|
17
|
+
|
18
|
+
def _empty_false(arr)
|
19
|
+
arr.empty? ? false : arr
|
20
|
+
end
|
21
|
+
|
22
|
+
def _opts_key(opts, key)
|
23
|
+
asse = opts.has_key?(key)
|
24
|
+
{ asse: asse, any: opts[key] }
|
25
|
+
end
|
26
|
+
|
27
|
+
def _asse_arr(opts)
|
28
|
+
asse = opts[:asse]
|
29
|
+
any = opts[:any]
|
30
|
+
if asse
|
31
|
+
any.instance_of?(Array) ? any : [any]
|
32
|
+
else
|
33
|
+
false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def _asse_opts_argv(opts, key)
|
38
|
+
_asse_arr(_opts_key(opts, key))
|
39
|
+
end
|
40
|
+
end
|
data/mod_comm.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/mod_comm/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "mod_comm"
|
7
|
+
spec.version = ModComm::VERSION
|
8
|
+
spec.authors = ["initdc"]
|
9
|
+
spec.email = ["initd@outlook.com"]
|
10
|
+
|
11
|
+
spec.summary = "Private method set"
|
12
|
+
spec.description = "Private methods for ruby module common use"
|
13
|
+
spec.homepage = "https://github.com/initdc/mod_comm"
|
14
|
+
spec.required_ruby_version = ">= 2.6.0"
|
15
|
+
|
16
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
17
|
+
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/initdc/mod_comm"
|
20
|
+
spec.metadata["changelog_uri"] = "https://github.com/initdc/mod_comm/blob/master/CHANGELOG.md"
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(__dir__) do
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
27
|
+
end
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
# Uncomment to register a new dependency of your gem
|
34
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
35
|
+
|
36
|
+
# For more information and examples about making a new gem, check out our
|
37
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
38
|
+
end
|
data/sig/mod_comm.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mod_comm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- initdc
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-12-30 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Private methods for ruby module common use
|
14
|
+
email:
|
15
|
+
- initd@outlook.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".rspec"
|
21
|
+
- ".rubocop.yml"
|
22
|
+
- CHANGELOG.md
|
23
|
+
- Gemfile
|
24
|
+
- Gemfile.lock
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- lib/mod_comm.rb
|
28
|
+
- lib/mod_comm/version.rb
|
29
|
+
- mod_comm.gemspec
|
30
|
+
- sig/mod_comm.rbs
|
31
|
+
homepage: https://github.com/initdc/mod_comm
|
32
|
+
licenses: []
|
33
|
+
metadata:
|
34
|
+
allowed_push_host: https://rubygems.org
|
35
|
+
homepage_uri: https://github.com/initdc/mod_comm
|
36
|
+
source_code_uri: https://github.com/initdc/mod_comm
|
37
|
+
changelog_uri: https://github.com/initdc/mod_comm/blob/master/CHANGELOG.md
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.6.0
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubygems_version: 3.2.3
|
54
|
+
signing_key:
|
55
|
+
specification_version: 4
|
56
|
+
summary: Private method set
|
57
|
+
test_files: []
|