windcharger 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +26 -0
- data/lib/windcharger/attributes.rb +4 -3
- data/lib/windcharger/version.rb +1 -1
- data/spec/windcharger/attributes_spec.rb +31 -0
- metadata +7 -7
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8e26b7926c106cea632124f5d031f2ae434e3641f13f6ca4d721284437e5505
|
4
|
+
data.tar.gz: 64bd2a8c7196e7469ebd575cf2cb1734a7d2734bb36382537d179a8d5f5c9cff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00a7a5a53d468f825de59165b294a08c13f1cf03634dfff0a3b566180628dddbdd877e931560fdf3e3341ff7093be215d03bf4a562c521d263e218b21227cb35
|
7
|
+
data.tar.gz: bf3d5b88e5b9fe7552b0f1b846e371648e38c1e5e623012757190b882f51b951b97350281f36a47f10046c316d995e1f8972e556c3836ae093f8f942d1befbf4
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
name: CI
|
3
|
+
|
4
|
+
'on':
|
5
|
+
pull_request:
|
6
|
+
push:
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
test:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
ruby-version:
|
14
|
+
- '2.6'
|
15
|
+
- '2.7'
|
16
|
+
- '3.0'
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- name: Setup
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
bundler-cache: true
|
25
|
+
- name: Run tests
|
26
|
+
run: bundle exec rake
|
@@ -3,13 +3,13 @@
|
|
3
3
|
module Windcharger
|
4
4
|
module Attributes
|
5
5
|
def attributes
|
6
|
-
(@
|
6
|
+
(@__windcharger_attributes ||= []).dup.freeze
|
7
7
|
end
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
11
|
def __windcharger_add_attribute name
|
12
|
-
(@
|
12
|
+
(@__windcharger_attributes ||= []) << name.to_sym
|
13
13
|
end
|
14
14
|
|
15
15
|
def attribute *attributes
|
@@ -21,7 +21,8 @@ module Windcharger
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def method_added name
|
24
|
-
|
24
|
+
super
|
25
|
+
return unless defined?(@__windcharger_next_is_attribute) && @__windcharger_next_is_attribute
|
25
26
|
__windcharger_add_attribute name
|
26
27
|
@__windcharger_next_is_attribute = false
|
27
28
|
end
|
data/lib/windcharger/version.rb
CHANGED
@@ -74,4 +74,35 @@ describe Windcharger::Attributes do
|
|
74
74
|
expect { transformer_class.attributes << :bar }.to raise_error FrozenError
|
75
75
|
expect(transformer_class.attributes).to eq [:foo]
|
76
76
|
end
|
77
|
+
|
78
|
+
it "does not break other method_added hooks" do
|
79
|
+
calls_before = []
|
80
|
+
calls_after = []
|
81
|
+
other_hooker_before = Module.new do
|
82
|
+
define_method :method_added do |name|
|
83
|
+
super name
|
84
|
+
calls_before << name
|
85
|
+
end
|
86
|
+
end
|
87
|
+
other_hooker_after = Module.new do
|
88
|
+
define_method :method_added do |name|
|
89
|
+
super name
|
90
|
+
calls_after << name
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
Class.new do
|
95
|
+
extend other_hooker_before
|
96
|
+
extend Windcharger::Attributes
|
97
|
+
extend other_hooker_after
|
98
|
+
|
99
|
+
attribute
|
100
|
+
def foo; end
|
101
|
+
|
102
|
+
def bar; end
|
103
|
+
end
|
104
|
+
|
105
|
+
expect(calls_before).to eq %i[foo bar]
|
106
|
+
expect(calls_after).to eq %i[foo bar]
|
107
|
+
end
|
77
108
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: windcharger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Marshall
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -65,8 +65,8 @@ executables: []
|
|
65
65
|
extensions: []
|
66
66
|
extra_rdoc_files: []
|
67
67
|
files:
|
68
|
+
- ".github/workflows/ci.yml"
|
68
69
|
- ".gitignore"
|
69
|
-
- ".travis.yml"
|
70
70
|
- Gemfile
|
71
71
|
- LICENSE.txt
|
72
72
|
- README.md
|
@@ -84,7 +84,7 @@ homepage: http://johnandrewmarshall.com/projects/windcharger
|
|
84
84
|
licenses:
|
85
85
|
- MIT
|
86
86
|
metadata: {}
|
87
|
-
post_install_message:
|
87
|
+
post_install_message:
|
88
88
|
rdoc_options: []
|
89
89
|
require_paths:
|
90
90
|
- lib
|
@@ -99,8 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.
|
103
|
-
signing_key:
|
102
|
+
rubygems_version: 3.2.26
|
103
|
+
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Small library to easily make objects that transform input via many methods.
|
106
106
|
test_files:
|