anima 0.1.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +32 -24
- data/lib/anima.rb +86 -112
- data/lib/anima/attribute.rb +7 -50
- data/lib/anima/error.rb +10 -20
- metadata +38 -56
- data/.gitignore +0 -5
- data/.travis.yml +0 -14
- data/Changelog.md +0 -20
- data/Gemfile +0 -6
- data/Gemfile.devtools +0 -55
- data/Guardfile +0 -18
- data/Rakefile +0 -2
- data/TODO +0 -3
- data/anima.gemspec +0 -21
- data/config/flay.yml +0 -3
- data/config/flog.yml +0 -2
- data/config/mutant.yml +0 -3
- data/config/reek.yml +0 -93
- data/config/roodi.yml +0 -18
- data/config/rubocop.yml +0 -85
- data/config/yardstick.yml +0 -2
- data/lib/anima/update.rb +0 -29
- data/spec/integration/simple_spec.rb +0 -56
- data/spec/spec_helper.rb +0 -8
- data/spec/unit/anima/attribute_spec.rb +0 -98
- data/spec/unit/anima/error_spec.rb +0 -16
- data/spec/unit/anima/update_spec.rb +0 -25
- data/spec/unit/anima_spec.rb +0 -134
data/lib/anima/error.rb
CHANGED
@@ -1,29 +1,19 @@
|
|
1
1
|
class Anima
|
2
|
-
|
3
2
|
# Abstract base class for anima errors
|
4
3
|
class Error < RuntimeError
|
5
|
-
|
4
|
+
FORMAT = '%s attributes missing: %s, unknown: %s'.freeze
|
5
|
+
private_constant(*constants(false))
|
6
6
|
|
7
7
|
# Initialize object
|
8
8
|
#
|
9
|
-
# @param [Class]
|
10
|
-
#
|
9
|
+
# @param [Class] klass
|
10
|
+
# the class being initialized
|
11
|
+
# @param [Enumerable<Symbol>] missing
|
12
|
+
# @param [Enumerable<Symbol>] unknown
|
11
13
|
#
|
12
14
|
# @return [undefined]
|
13
|
-
|
14
|
-
|
15
|
-
#
|
16
|
-
def initialize(model, names)
|
17
|
-
super("#{self.class.name.split('::').last} attribute(s) #{names.inspect} for #{model.name}")
|
18
|
-
end
|
19
|
-
|
20
|
-
# Error for unknown attributes
|
21
|
-
class Unknown < self
|
22
|
-
end
|
23
|
-
|
24
|
-
# Error for missing attributes
|
25
|
-
class Missing < self
|
15
|
+
def initialize(klass, missing, unknown)
|
16
|
+
super(FORMAT % [klass, missing, unknown])
|
26
17
|
end
|
27
|
-
|
28
|
-
|
29
|
-
end
|
18
|
+
end # Error
|
19
|
+
end # Anima
|
metadata
CHANGED
@@ -1,121 +1,103 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anima
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: adamantium
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: '0.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: 0.
|
26
|
+
version: '0.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: equalizer
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.11
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.11
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: abstract_type
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.0.
|
47
|
+
version: 0.0.7
|
48
48
|
type: :runtime
|
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: 0.0.
|
55
|
-
|
54
|
+
version: 0.0.7
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: devtools
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.24
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.1.24
|
69
|
+
description:
|
56
70
|
email: mbj@schirp-dso.com
|
57
71
|
executables: []
|
58
72
|
extensions: []
|
59
73
|
extra_rdoc_files:
|
60
74
|
- README.md
|
61
75
|
files:
|
62
|
-
- .gitignore
|
63
|
-
- .rspec
|
64
|
-
- .travis.yml
|
65
|
-
- Changelog.md
|
66
|
-
- Gemfile
|
67
|
-
- Gemfile.devtools
|
68
|
-
- Guardfile
|
69
76
|
- README.md
|
70
|
-
- Rakefile
|
71
|
-
- TODO
|
72
|
-
- anima.gemspec
|
73
|
-
- config/flay.yml
|
74
|
-
- config/flog.yml
|
75
|
-
- config/mutant.yml
|
76
|
-
- config/reek.yml
|
77
|
-
- config/roodi.yml
|
78
|
-
- config/rubocop.yml
|
79
|
-
- config/yardstick.yml
|
80
77
|
- lib/anima.rb
|
81
78
|
- lib/anima/attribute.rb
|
82
79
|
- lib/anima/error.rb
|
83
|
-
- lib/anima/update.rb
|
84
|
-
- spec/integration/simple_spec.rb
|
85
|
-
- spec/spec_helper.rb
|
86
|
-
- spec/unit/anima/attribute_spec.rb
|
87
|
-
- spec/unit/anima/error_spec.rb
|
88
|
-
- spec/unit/anima/update_spec.rb
|
89
|
-
- spec/unit/anima_spec.rb
|
90
80
|
homepage: http://github.com/mbj/anima
|
91
81
|
licenses:
|
92
82
|
- MIT
|
93
83
|
metadata: {}
|
94
|
-
post_install_message:
|
84
|
+
post_install_message:
|
95
85
|
rdoc_options: []
|
96
86
|
require_paths:
|
97
87
|
- lib
|
98
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
89
|
requirements:
|
100
|
-
- -
|
90
|
+
- - ">="
|
101
91
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
92
|
+
version: 2.1.0
|
103
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
94
|
requirements:
|
105
|
-
- -
|
95
|
+
- - ">="
|
106
96
|
- !ruby/object:Gem::Version
|
107
97
|
version: '0'
|
108
98
|
requirements: []
|
109
|
-
|
110
|
-
|
111
|
-
signing_key:
|
99
|
+
rubygems_version: 3.1.2
|
100
|
+
signing_key:
|
112
101
|
specification_version: 4
|
113
|
-
summary:
|
114
|
-
test_files:
|
115
|
-
- spec/integration/simple_spec.rb
|
116
|
-
- spec/spec_helper.rb
|
117
|
-
- spec/unit/anima/attribute_spec.rb
|
118
|
-
- spec/unit/anima/error_spec.rb
|
119
|
-
- spec/unit/anima/update_spec.rb
|
120
|
-
- spec/unit/anima_spec.rb
|
121
|
-
has_rdoc:
|
102
|
+
summary: Initialize object attributes via attributes hash
|
103
|
+
test_files: []
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Changelog.md
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# v0.0.6 2013-02-18
|
2
|
-
|
3
|
-
* [add] Support for updates via Anima::Update mixin
|
4
|
-
* [change] Update dependencies
|
5
|
-
|
6
|
-
# v0.0.5 2013-02-17
|
7
|
-
|
8
|
-
* [changed] Update dependencies
|
9
|
-
|
10
|
-
# v0.0.4 2013-01-21
|
11
|
-
|
12
|
-
* [changed] Update dependencies
|
13
|
-
|
14
|
-
# v0.0.3 2012-12-13
|
15
|
-
|
16
|
-
* [changed] Use the attributes_hash naming consistently.
|
17
|
-
|
18
|
-
# v0.0.2 2012-12-13
|
19
|
-
|
20
|
-
First public release!
|
data/Gemfile
DELETED
data/Gemfile.devtools
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
group :development do
|
4
|
-
gem 'rake', '~> 10.1.0'
|
5
|
-
gem 'rspec', '~> 2.14.1'
|
6
|
-
gem 'yard', '~> 0.8.7'
|
7
|
-
end
|
8
|
-
|
9
|
-
group :yard do
|
10
|
-
gem 'kramdown', '~> 1.1.0'
|
11
|
-
end
|
12
|
-
|
13
|
-
group :guard do
|
14
|
-
gem 'guard', '~> 1.8.1'
|
15
|
-
gem 'guard-bundler', '~> 1.0.0'
|
16
|
-
gem 'guard-rspec', '~> 3.0.2'
|
17
|
-
gem 'guard-rubocop', '~> 0.2.0'
|
18
|
-
# gem 'guard-mutant', '~> 0.0.1'
|
19
|
-
|
20
|
-
# file system change event handling
|
21
|
-
gem 'listen', '~> 1.3.0'
|
22
|
-
gem 'rb-fchange', '~> 0.0.6', require: false
|
23
|
-
gem 'rb-fsevent', '~> 0.9.3', require: false
|
24
|
-
gem 'rb-inotify', '~> 0.9.0', require: false
|
25
|
-
|
26
|
-
# notification handling
|
27
|
-
gem 'libnotify', '~> 0.8.0', require: false
|
28
|
-
gem 'rb-notifu', '~> 0.0.4', require: false
|
29
|
-
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
30
|
-
end
|
31
|
-
|
32
|
-
group :metrics do
|
33
|
-
gem 'coveralls', '~> 0.6.7'
|
34
|
-
gem 'flay', '~> 2.4.0'
|
35
|
-
gem 'flog', '~> 4.1.1'
|
36
|
-
gem 'reek', '~> 1.3.2'
|
37
|
-
gem 'rubocop', '~> 0.11.0'
|
38
|
-
gem 'simplecov', '~> 0.7.1'
|
39
|
-
gem 'yardstick', '~> 0.9.7', git: 'https://github.com/dkubb/yardstick.git'
|
40
|
-
|
41
|
-
platforms :ruby_19, :ruby_20 do
|
42
|
-
# gem 'mutant', git: 'https://github.com/mbj/mutant.git'
|
43
|
-
gem 'yard-spellcheck', '~> 0.1.5'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
group :benchmarks do
|
48
|
-
gem 'rbench', '~> 0.2.3'
|
49
|
-
end
|
50
|
-
|
51
|
-
platform :jruby do
|
52
|
-
group :jruby do
|
53
|
-
gem 'jruby-openssl', '~> 0.8.5'
|
54
|
-
end
|
55
|
-
end
|
data/Guardfile
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
guard :bundler do
|
4
|
-
watch('Gemfile')
|
5
|
-
end
|
6
|
-
|
7
|
-
guard :rspec, :version => 2 do
|
8
|
-
# run all specs if the spec_helper or supporting files files are modified
|
9
|
-
watch('spec/spec_helper.rb') { 'spec' }
|
10
|
-
watch(%r{\Aspec/(?:lib|support|shared)/.+\.rb\z}) { 'spec' }
|
11
|
-
|
12
|
-
# run unit specs if associated lib code is modified
|
13
|
-
watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}"] }
|
14
|
-
watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec' }
|
15
|
-
|
16
|
-
# run a spec if it is modified
|
17
|
-
watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z})
|
18
|
-
end
|
data/Rakefile
DELETED
data/TODO
DELETED
data/anima.gemspec
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = 'anima'
|
5
|
-
s.version = '0.1.0'
|
6
|
-
|
7
|
-
s.authors = ['Markus Schirp']
|
8
|
-
s.email = 'mbj@schirp-dso.com'
|
9
|
-
s.summary = 'Attributes for Plain Old Ruby Objects Experiment'
|
10
|
-
s.homepage = 'http://github.com/mbj/anima'
|
11
|
-
s.license = 'MIT'
|
12
|
-
|
13
|
-
s.files = `git ls-files`.split("\n")
|
14
|
-
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
15
|
-
s.require_paths = %w(lib)
|
16
|
-
s.extra_rdoc_files = %w(README.md)
|
17
|
-
|
18
|
-
s.add_dependency('adamantium', '~> 0.1.0')
|
19
|
-
s.add_dependency('equalizer', '~> 0.0.7')
|
20
|
-
s.add_dependency('abstract_type', '~> 0.0.6')
|
21
|
-
end
|
data/config/flay.yml
DELETED
data/config/flog.yml
DELETED
data/config/mutant.yml
DELETED
data/config/reek.yml
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
---
|
2
|
-
UncommunicativeParameterName:
|
3
|
-
accept: []
|
4
|
-
exclude: []
|
5
|
-
enabled: true
|
6
|
-
reject:
|
7
|
-
- !ruby/regexp /^.$/
|
8
|
-
- !ruby/regexp /[0-9]$/
|
9
|
-
- !ruby/regexp /[A-Z]/
|
10
|
-
TooManyMethods:
|
11
|
-
max_methods: 13
|
12
|
-
exclude: []
|
13
|
-
enabled: true
|
14
|
-
max_instance_variables: 2
|
15
|
-
UncommunicativeMethodName:
|
16
|
-
accept: []
|
17
|
-
exclude: []
|
18
|
-
enabled: true
|
19
|
-
reject:
|
20
|
-
- !ruby/regexp /^[a-z]$/
|
21
|
-
- !ruby/regexp /[0-9]$/
|
22
|
-
- !ruby/regexp /[A-Z]/
|
23
|
-
LongParameterList:
|
24
|
-
max_params: 2 # TODO: decrease max_params to 2
|
25
|
-
exclude: []
|
26
|
-
enabled: true
|
27
|
-
overrides: {}
|
28
|
-
FeatureEnvy:
|
29
|
-
exclude:
|
30
|
-
- Anima#attributes_hash
|
31
|
-
enabled: true
|
32
|
-
ClassVariable:
|
33
|
-
exclude: []
|
34
|
-
enabled: true
|
35
|
-
BooleanParameter:
|
36
|
-
exclude: []
|
37
|
-
enabled: true
|
38
|
-
IrresponsibleModule:
|
39
|
-
exclude: []
|
40
|
-
enabled: true
|
41
|
-
UncommunicativeModuleName:
|
42
|
-
accept: []
|
43
|
-
exclude: []
|
44
|
-
enabled: true
|
45
|
-
reject:
|
46
|
-
- !ruby/regexp /^.$/
|
47
|
-
- !ruby/regexp /[0-9]$/
|
48
|
-
NestedIterators:
|
49
|
-
ignore_iterators: []
|
50
|
-
exclude:
|
51
|
-
- Anima::Attribute#define_reader # 2 levels
|
52
|
-
enabled: true
|
53
|
-
max_allowed_nesting: 1
|
54
|
-
TooManyStatements:
|
55
|
-
max_statements: 7 # TODO: decrease max_statements to 5 or less
|
56
|
-
exclude: []
|
57
|
-
enabled: true
|
58
|
-
DuplicateMethodCall:
|
59
|
-
allow_calls: []
|
60
|
-
exclude: []
|
61
|
-
enabled: true
|
62
|
-
max_calls: 1
|
63
|
-
UtilityFunction:
|
64
|
-
max_helper_calls: 1
|
65
|
-
exclude: []
|
66
|
-
enabled: true
|
67
|
-
Attribute:
|
68
|
-
exclude: []
|
69
|
-
enabled: false
|
70
|
-
UncommunicativeVariableName:
|
71
|
-
accept: []
|
72
|
-
exclude: []
|
73
|
-
enabled: true
|
74
|
-
reject:
|
75
|
-
- !ruby/regexp /^.$/
|
76
|
-
- !ruby/regexp /[0-9]$/
|
77
|
-
- !ruby/regexp /[A-Z]/
|
78
|
-
RepeatedConditional:
|
79
|
-
exclude: []
|
80
|
-
enabled: true
|
81
|
-
max_ifs: 1
|
82
|
-
DataClump:
|
83
|
-
exclude: []
|
84
|
-
enabled: true
|
85
|
-
max_copies: 1
|
86
|
-
min_clump_size: 3
|
87
|
-
ControlParameter:
|
88
|
-
exclude: []
|
89
|
-
enabled: true
|
90
|
-
LongYieldList:
|
91
|
-
max_params: 1
|
92
|
-
exclude: []
|
93
|
-
enabled: true
|