decors 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/CHANGELOG.md +3 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +20 -22
- data/decors.gemspec +17 -15
- data/lib/decors.rb +3 -1
- data/lib/decors/decorator_base.rb +22 -20
- data/lib/decors/decorator_definition.rb +13 -11
- data/lib/decors/method_added.rb +61 -53
- data/lib/decors/utils.rb +15 -13
- data/spec/decors_spec.rb +391 -389
- data/spec/spec_helper.rb +14 -12
- metadata +3 -4
data/spec/spec_helper.rb
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path('../lib/decors', __dir__)
|
2
4
|
|
3
5
|
module SpecHelpers
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
def stub_class(class_name, inherits: [], &class_eval)
|
7
|
+
klass = stub_const(class_name.to_s, Class.new(*inherits))
|
8
|
+
klass.class_eval(&class_eval) if class_eval
|
9
|
+
klass
|
10
|
+
end
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
def stub_module(module_name, &module_eval)
|
13
|
+
mod = stub_const(module_name.to_s, Module.new)
|
14
|
+
mod.module_eval(&module_eval) if module_eval
|
15
|
+
mod
|
16
|
+
end
|
15
17
|
end
|
16
18
|
|
17
19
|
RSpec.configure do |config|
|
18
|
-
|
20
|
+
config.include SpecHelpers
|
19
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vivien Meyet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -80,8 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
|
-
|
84
|
-
rubygems_version: 2.5.1
|
83
|
+
rubygems_version: 3.1.2
|
85
84
|
signing_key:
|
86
85
|
specification_version: 4
|
87
86
|
summary: Ruby implementation of Python method decorators / Java annotations
|