fancy_to_proc 0.1.0 → 0.1.1
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/README.md +16 -0
- data/lib/fancy_to_proc/version.rb +1 -1
- data/lib/fancy_to_proc.rb +1 -0
- data/lib/rubocop/cop/fancy_to_proc/space_around_most_operators.rb +19 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae960da5e4467e8dd224664027b163b1cf2b786e
|
4
|
+
data.tar.gz: 27c2223f8297de508a74062895d307b6eb50fc68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6467c9d907e3a5b65d0918c397ffe380ecee0b0cbbb0cbf591d97d08189dabadda22863f85340e459ce96881d79a033bf6fcee6b3e366b1e33608a0d6ddcf8f
|
7
|
+
data.tar.gz: 1e2b09e9e562eb1f3fe68d5b1dd5a7ce5ae5516cc8fd0a47c1d67160a267c4c5977d3c705b13dcfc16daa0314c39c5839241e337927d0f4019aa20580ff2220e
|
data/README.md
CHANGED
@@ -115,6 +115,22 @@ Or install it yourself as:
|
|
115
115
|
$ gem install fancy_to_proc
|
116
116
|
|
117
117
|
|
118
|
+
## RuboCop
|
119
|
+
|
120
|
+
RuboCop will complain if you don't put spaces around `&` so I've provided a monkeypatch (yay) to RuboCop's "SpaceAroundOperators" cop to ignore just the `&`.
|
121
|
+
|
122
|
+
To use project-wide require `fancy_to_proc` at the top of your `.rubocop.yml`:
|
123
|
+
|
124
|
+
```yaml
|
125
|
+
require: fancy_to_proc
|
126
|
+
```
|
127
|
+
|
128
|
+
Or to use on the command line require it with a flag:
|
129
|
+
|
130
|
+
```sh
|
131
|
+
rubocop --require fancy_to_proc
|
132
|
+
```
|
133
|
+
|
118
134
|
## Development
|
119
135
|
|
120
136
|
Run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/fancy_to_proc.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
begin
|
4
|
+
class RuboCop::Cop::Style::SpaceAroundOperators
|
5
|
+
def on_send(node)
|
6
|
+
if node.loc.operator # aref assignment, attribute assignment
|
7
|
+
on_special_asgn(node)
|
8
|
+
elsif !node.unary_operation? && !called_with_dot?(node)
|
9
|
+
op = node.method_name
|
10
|
+
if op != :[] && op != :! && op != :[]= && op != :& && operator?(op)
|
11
|
+
_, _, right, = *node
|
12
|
+
check_operator(node.loc.selector, right.source_range)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
rescue NameError
|
18
|
+
nil
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fancy_to_proc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon George
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- fancy_to_proc.gemspec
|
73
73
|
- lib/fancy_to_proc.rb
|
74
74
|
- lib/fancy_to_proc/version.rb
|
75
|
+
- lib/rubocop/cop/fancy_to_proc/space_around_most_operators.rb
|
75
76
|
homepage: https://github.com/sfcgeorge/fancy_to_proc
|
76
77
|
licenses: []
|
77
78
|
metadata: {}
|
@@ -91,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
92
|
version: '0'
|
92
93
|
requirements: []
|
93
94
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.5.1
|
95
96
|
signing_key:
|
96
97
|
specification_version: 4
|
97
98
|
summary: Makes Symbol#to_proc chainable and take arguments
|