dry-core 0.2.1 → 0.2.2
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/.travis.yml +15 -16
- data/CHANGELOG.md +23 -0
- data/Gemfile +6 -1
- data/lib/dry/core/class_attributes.rb +56 -0
- data/lib/dry/core/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cda658e37465a08818afb903edaea82495ddf187
|
4
|
+
data.tar.gz: c42fe5181332a11dbafb8372beb33560729eb8f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84859f9272f18fb395caeb408a646afe0aa08992a54218376f9de5b2d2acf4da00c92ab9a60263431202a597989fc7339f5be52dd670c7ce552ff8d52f720614
|
7
|
+
data.tar.gz: e5b6cb8eff0806b7fbb6cba028d602ae8255f02df45d2061fb1dad74f714d0b20b1afbd8fbfc695c09360068a3dfdcdf8caf9cd571816212eb4ff2ca93884ef6
|
data/.travis.yml
CHANGED
@@ -1,29 +1,28 @@
|
|
1
1
|
language: ruby
|
2
2
|
dist: trusty
|
3
|
-
sudo:
|
3
|
+
sudo: required
|
4
4
|
cache: bundler
|
5
|
+
bundler_args: --without benchmarks tools
|
6
|
+
after_success:
|
7
|
+
- '[ -d coverage ] && bundle exec codeclimate-test-reporter'
|
8
|
+
script:
|
9
|
+
- bundle exec rake
|
5
10
|
rvm:
|
6
|
-
- 2.
|
7
|
-
- 2.2
|
8
|
-
- 2.
|
11
|
+
- 2.1
|
12
|
+
- 2.2
|
13
|
+
- 2.3
|
14
|
+
- 2.4.0
|
9
15
|
- jruby-9.1.5.0
|
10
|
-
- ruby-head
|
11
16
|
- rbx-3
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
17
|
+
env:
|
18
|
+
global:
|
19
|
+
- COVERAGE=true
|
20
|
+
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
16
21
|
matrix:
|
17
22
|
allow_failures:
|
18
|
-
- rvm: ruby-head
|
19
23
|
- rvm: rbx-3
|
20
24
|
notifications:
|
21
|
-
email:
|
22
|
-
recipients:
|
23
|
-
- fg@flashgordon.ru
|
24
|
-
on_success: change
|
25
|
-
on_failure: always
|
26
|
-
on_start: false # default: false
|
25
|
+
email: false
|
27
26
|
webhooks:
|
28
27
|
urls:
|
29
28
|
- https://webhooks.gitter.im/e/19098b4253a72c9796db
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# v0.2.2 2016-12-30
|
2
|
+
|
3
|
+
### Added
|
4
|
+
|
5
|
+
* `ClassAttributes` which provides `defines` method for defining get-or-set methods (flash-gordon)
|
6
|
+
|
7
|
+
[Compare v0.2.1...v0.2.2](https://github.com/dry-rb/dry-core/compare/v0.2.1...v0.2.2)
|
8
|
+
|
9
|
+
# v0.2.1 2016-11-18
|
10
|
+
|
11
|
+
### Added
|
12
|
+
|
13
|
+
* `Constants` are now available in nested scopes (flash-gordon)
|
14
|
+
|
15
|
+
[Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-core/compare/v0.2.0...v0.2.1)
|
16
|
+
|
17
|
+
# v0.2.0 2016-11-01
|
18
|
+
|
19
|
+
[Compare v0.1.0...v0.2.0](https://github.com/dry-rb/dry-core/compare/v0.1.0...v0.2.0)
|
20
|
+
|
21
|
+
# v0.1.0 2016-09-17
|
22
|
+
|
23
|
+
Initial release
|
data/Gemfile
CHANGED
@@ -3,7 +3,12 @@ source 'https://rubygems.org'
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :test do
|
6
|
-
|
6
|
+
if RUBY_VERSION >= '2.4'
|
7
|
+
gem 'activesupport'
|
8
|
+
else
|
9
|
+
gem 'activesupport', '~> 4.2'
|
10
|
+
end
|
11
|
+
|
7
12
|
gem 'inflecto', '~> 0.0', '>= 0.0.2'
|
8
13
|
gem 'codeclimate-test-reporter', require: false
|
9
14
|
gem 'simplecov', require: false
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'dry/core/constants'
|
2
|
+
|
3
|
+
module Dry
|
4
|
+
module Core
|
5
|
+
# Internal support module for class-level settings
|
6
|
+
#
|
7
|
+
# @api public
|
8
|
+
module ClassAttributes
|
9
|
+
include Constants
|
10
|
+
|
11
|
+
# Specify what attirubtes a class will use
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# class MyClass
|
15
|
+
# extend Dry::Core::ClassAttributes
|
16
|
+
#
|
17
|
+
# defines :one, :two
|
18
|
+
#
|
19
|
+
# one 1
|
20
|
+
# two 2
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# class OtherClass < MyClass
|
24
|
+
# two 'two'
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# MyClass.one # => 1
|
28
|
+
# MyClass.two # => 2
|
29
|
+
#
|
30
|
+
# OtherClass.one # => 1
|
31
|
+
# OtherClass.two # => 'two'
|
32
|
+
def defines(*args)
|
33
|
+
mod = Module.new do
|
34
|
+
args.each do |name|
|
35
|
+
define_method(name) do |value = Undefined|
|
36
|
+
ivar = "@#{name}"
|
37
|
+
|
38
|
+
if value == Undefined
|
39
|
+
defined?(ivar) && instance_variable_get(ivar)
|
40
|
+
else
|
41
|
+
instance_variable_set(ivar, value)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
define_method(:inherited) do |klass|
|
47
|
+
super(klass)
|
48
|
+
args.each { |name| klass.public_send(name, send(name)) }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
extend(mod)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/dry/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikita Shilnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- ".rspec"
|
79
79
|
- ".rubocop.yml"
|
80
80
|
- ".travis.yml"
|
81
|
+
- CHANGELOG.md
|
81
82
|
- Gemfile
|
82
83
|
- LICENSE.txt
|
83
84
|
- README.md
|
@@ -86,6 +87,7 @@ files:
|
|
86
87
|
- lib/dry-core.rb
|
87
88
|
- lib/dry/core.rb
|
88
89
|
- lib/dry/core/cache.rb
|
90
|
+
- lib/dry/core/class_attributes.rb
|
89
91
|
- lib/dry/core/class_builder.rb
|
90
92
|
- lib/dry/core/constants.rb
|
91
93
|
- lib/dry/core/deprecations.rb
|