multi_block 1.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/{CHANGELOG.rdoc → CHANGELOG.md} +11 -2
- data/CODE_OF_CONDUCT.md +74 -0
- data/{README.rdoc → README.md} +13 -11
- data/lib/multi_block/version.rb +3 -1
- data/multi_block.gemspec +4 -4
- metadata +14 -15
- data/.travis.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4a6ff03fb7c3235d1d48b5fe5f64590fd6c8e74d2621d62aed2870e105a36904
|
4
|
+
data.tar.gz: 7131421a9ae98d9eb53b92220362435ebace0f177e3e1495f2d293f333b9cd42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fb4375c0a9fb3a8d463836ea3f90aa6d3ed95cf43bf7f2ee378f3a8d7024b2355a6a376e4b2abbbca648cf208458b5ddfdaa385dc2210335f50464b3a21b8c4
|
7
|
+
data.tar.gz: e5da313ef554331df006502215bb6e0268d9c708b405d3eb5e1f7521dc916dd8fc86c573b1d03a535c5d58ab1b125e60389dc4443c86dbbfaca61dc40952bae9
|
@@ -1,6 +1,15 @@
|
|
1
|
-
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## 1.2
|
4
|
+
|
5
|
+
* Update project setup to 2021
|
6
|
+
* Re-release
|
7
|
+
|
8
|
+
## 1.1
|
9
|
+
|
2
10
|
* Updates for 2015 Rubies, drop support for Ruby 1
|
3
11
|
* Simplify activating Array extension via: require 'multi_block/array'
|
4
12
|
|
5
|
-
|
13
|
+
## 1.0
|
14
|
+
|
6
15
|
* Initial Release
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at conduct@janlelis.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/{README.rdoc → README.md}
RENAMED
@@ -1,17 +1,18 @@
|
|
1
|
-
|
1
|
+
# MultiBlock [<img src="https://badge.fury.io/rb/multi_block.svg" />](https://badge.fury.io/rb/multi_block) [<img src="https://github.com/janlelis/multi_block/workflows/Test/badge.svg" />](https://github.com/janlelis/multi_block/actions?query=workflow%3ATest)
|
2
2
|
|
3
|
-
MultiBlock is a mini framework for passing multiple blocks to methods. It uses
|
3
|
+
MultiBlock is a mini framework for passing multiple blocks to methods. It uses [named procs](https://github.com/janlelis/named_proc) to accomplish this with a simple syntax. The receiving method can either yield all blocks, or just call specific ones, identified by order or name.
|
4
4
|
|
5
|
+
Currently supports CRuby only.
|
5
6
|
|
6
|
-
|
7
|
+
## Setup
|
7
8
|
|
8
9
|
Add to Gemfile:
|
9
10
|
|
10
11
|
gem 'multi_block'
|
11
12
|
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
## Usage
|
15
|
+
### Defining methods that use multiple blocks
|
15
16
|
|
16
17
|
The first argument given to yield always defines the desired block(s). The other arguments get directly passed to the block(s):
|
17
18
|
|
@@ -25,7 +26,7 @@ The first argument given to yield always defines the desired block(s). The other
|
|
25
26
|
error: [500, "Internal Brawl Error"] # values are the args
|
26
27
|
|
27
28
|
|
28
|
-
|
29
|
+
### Calling methods with multiple blocks
|
29
30
|
|
30
31
|
Consider these two example methods:
|
31
32
|
|
@@ -41,7 +42,7 @@ Consider these two example methods:
|
|
41
42
|
end
|
42
43
|
|
43
44
|
|
44
|
-
Multiple blocks can be passed using
|
45
|
+
Multiple blocks can be passed using `blocks`:
|
45
46
|
|
46
47
|
ajax &blocks[
|
47
48
|
proc.success{ puts "Yeah!" },
|
@@ -61,13 +62,13 @@ The dice method could, for example, be called in this way:
|
|
61
62
|
]
|
62
63
|
|
63
64
|
|
64
|
-
|
65
|
+
## Bonus sugar: Array extension
|
65
66
|
|
66
|
-
If you like the slim
|
67
|
+
If you like the slim `&to_proc` operator, you can further optimize the syntax by activating the core extension for array:
|
67
68
|
|
68
69
|
require 'multi_block/array'
|
69
70
|
|
70
|
-
Now you do not need the
|
71
|
+
Now you do not need the `blocks` helper anymore. Instead just do:
|
71
72
|
|
72
73
|
do_something, some_argument, &[
|
73
74
|
proc.easy_way{
|
@@ -79,5 +80,6 @@ Now you do not need the +blocks+ helper anymore. Instead just do:
|
|
79
80
|
]
|
80
81
|
|
81
82
|
|
82
|
-
|
83
|
+
## MIT License
|
84
|
+
|
83
85
|
See the original gist: https://gist.github.com/4b2f5fd0b45118e46d0f
|
data/lib/multi_block/version.rb
CHANGED
data/multi_block.gemspec
CHANGED
@@ -6,15 +6,15 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "multi_block"
|
7
7
|
s.version = MultiBlock::VERSION
|
8
8
|
s.authors = ["Jan Lelis"]
|
9
|
-
s.email = "
|
9
|
+
s.email = "hi@ruby.consulting"
|
10
10
|
s.homepage = "https://github.com/janlelis/multi_block"
|
11
11
|
s.summary = 'MultiBlock is a mini framework for passing multiple blocks to methods.'
|
12
12
|
s.description = 'MultiBlock is a mini framework for passing multiple blocks to methods. It uses "named procs" to accomplish this in a nice way. The receiving method can either yield all blocks, or just call specific ones, identified by order or name. '
|
13
13
|
s.required_ruby_version = '>= 1.9.3'
|
14
14
|
s.files = Dir.glob %w{multi_block.gemspec lib/multi_block.rb lib/multi_block/version.rb lib/multi_block/implementation.rb lib/multi_block/core_ext.rb lib/multi_block/array.rb spec/multi_block_spec.rb}
|
15
|
-
s.extra_rdoc_files = ["README.
|
15
|
+
s.extra_rdoc_files = ["README.md", "MIT-LICENSE.txt", "CHANGELOG.md", "CODE_OF_CONDUCT.md"]
|
16
16
|
s.license = 'MIT'
|
17
|
-
s.add_dependency 'named_proc', '~> 1.
|
17
|
+
s.add_dependency 'named_proc', '~> 1.2'
|
18
18
|
s.add_development_dependency 'rspec', '~> 3.2'
|
19
|
-
s.add_development_dependency 'rake', '~>
|
19
|
+
s.add_development_dependency 'rake', '~> 13.0'
|
20
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_block
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: named_proc
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,30 +44,30 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
description: 'MultiBlock is a mini framework for passing multiple blocks to methods.
|
56
56
|
It uses "named procs" to accomplish this in a nice way. The receiving method can
|
57
57
|
either yield all blocks, or just call specific ones, identified by order or name. '
|
58
|
-
email:
|
58
|
+
email: hi@ruby.consulting
|
59
59
|
executables: []
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files:
|
62
|
-
- README.
|
62
|
+
- README.md
|
63
63
|
- MIT-LICENSE.txt
|
64
|
-
- CHANGELOG.
|
65
|
-
-
|
64
|
+
- CHANGELOG.md
|
65
|
+
- CODE_OF_CONDUCT.md
|
66
66
|
files:
|
67
|
-
-
|
68
|
-
-
|
67
|
+
- CHANGELOG.md
|
68
|
+
- CODE_OF_CONDUCT.md
|
69
69
|
- MIT-LICENSE.txt
|
70
|
-
- README.
|
70
|
+
- README.md
|
71
71
|
- lib/multi_block.rb
|
72
72
|
- lib/multi_block/array.rb
|
73
73
|
- lib/multi_block/core_ext.rb
|
@@ -94,8 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
|
-
|
98
|
-
rubygems_version: 2.4.6
|
97
|
+
rubygems_version: 3.2.22
|
99
98
|
signing_key:
|
100
99
|
specification_version: 4
|
101
100
|
summary: MultiBlock is a mini framework for passing multiple blocks to methods.
|