attributes_dsl 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c399823c440258ebcd951ce049e16877934b630
4
- data.tar.gz: 345a83666686089656e22eb5a38f88997baccd41
3
+ metadata.gz: d14f92013d4337b03374d318bb1cacef54de0a72
4
+ data.tar.gz: 10c7343c3daa99636e9b7cb7304c1e190cbc3b62
5
5
  SHA512:
6
- metadata.gz: a25c08685b444464ad501a9a0a5a9d945ea854bef5959241b53918470a7dbda28d0c173aec1c6a57709ad637c490ec8864bafad9f2c1cc5a6d622d56450a667f
7
- data.tar.gz: 36a64b86b318bbad9cfbceddefdf9fb49616f2443f259a2024642461fdb03d6eb143216913e24cfd402938c37ef38c6ea8cce2da8b1f42eec67022931cb40aac
6
+ metadata.gz: fb2f737752bef7c008352bd5fe06536623915a6f6287f8cb35ac0ffd5599f64e4a3d2605cd3f86273fd5377e084e8de199d1381fd6fbfcdd685328d9997e1781
7
+ data.tar.gz: c5702e2dfd42146102d49eee381efd4d7efa10191b99bdf07ce4884b747dc9f24f9a2c47be1752b89bbea5880d0376023c9cf3e0a21f1357c9c3c7a067893e19
@@ -4,11 +4,14 @@ bundler_args: --without metrics --without benchmarks
4
4
  cache: bundler
5
5
  script: bundle exec rake test:coverage:run
6
6
  rvm:
7
+ - '2.0'
7
8
  - '2.1'
8
9
  - '2.2'
10
+ - '2.3.0'
9
11
  - ruby-head
10
- - rbx-2 --2.1
11
- - jruby-9.0.0.0
12
+ - rbx-2
13
+ - jruby-1.7
14
+ - jruby-9000
12
15
  - jruby-head
13
16
  matrix:
14
17
  allow_failures:
@@ -1,3 +1,9 @@
1
+ ## version 0.1.1 2016-01-16
2
+
3
+ Add support for Rubies 2.0
4
+
5
+ [Compare v0.1.0...v0.1.1](https://github.com/nepalez/attributes_dsl/compare/v0.1.0...v0.1.1)
6
+
1
7
  ## version 0.1.0 2015-12-08
2
8
 
3
9
  Stabilized DSL
data/Gemfile CHANGED
@@ -11,6 +11,6 @@ group :benchmarks do
11
11
  gem "benchmark-ips"
12
12
  gem "active_attr"
13
13
  gem "fast_attributes"
14
- gem "anima"
14
+ gem "anima" if RUBY_VERSION >= "2.1"
15
15
  gem "kwattr"
16
16
  end
data/README.md CHANGED
@@ -186,7 +186,7 @@ gem install attributes_dsl
186
186
  Compatibility
187
187
  -------------
188
188
 
189
- Tested under rubies [compatible to MRI 2.1+][versions].
189
+ Tested under rubies compatible to [MRI 2.0+][versions].
190
190
 
191
191
  Uses [RSpec][rspec] 3.0+ for testing and [hexx-suit][hexx-suit] for dev/test tools collection.
192
192
 
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.extra_rdoc_files = Dir["README.md", "LICENSE"]
16
16
  gem.require_paths = ["lib"]
17
17
 
18
- gem.required_ruby_version = ">= 2.1"
18
+ gem.required_ruby_version = ">= 2.0"
19
19
 
20
20
  gem.add_runtime_dependency "equalizer", "~> 0.0.11"
21
21
  gem.add_runtime_dependency "transproc", "~> 0.4.0"
@@ -21,9 +21,8 @@ module AttributesDSL
21
21
  #
22
22
  def self.filter(attributes, keys)
23
23
  attributes
24
- .map { |key, value| [key.to_sym, value] }
24
+ .inject({}) { |hash, (key, value)| hash.merge(key.to_sym => value) }
25
25
  .select { |key, _| keys.include? key }
26
- .to_h
27
26
  end
28
27
 
29
28
  # Ensures all given keys are present in the hash
@@ -38,7 +37,9 @@ module AttributesDSL
38
37
  # @return [Hash]
39
38
  #
40
39
  def self.update(attributes, keys)
41
- keys.map { |key| [key, attributes[key]] }.to_h
40
+ keys
41
+ .inject({}) { |hash, key| hash.merge(key => nil) }
42
+ .merge(attributes)
42
43
  end
43
44
 
44
45
  # Checks whether the name is present in attributes' keys,
@@ -4,6 +4,6 @@ module AttributesDSL
4
4
 
5
5
  # The semantic version of the module.
6
6
  # @see http://semver.org/ Semantic versioning 2.0
7
- VERSION = "0.1.0".freeze
7
+ VERSION = "0.1.1".freeze
8
8
 
9
9
  end # module AttributesDSL
metadata CHANGED
@@ -1,72 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attributes_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kozin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-08 00:00:00.000000000 Z
11
+ date: 2016-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: equalizer
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - "~>"
16
+ - - ~>
18
17
  - !ruby/object:Gem::Version
19
18
  version: 0.0.11
20
- type: :runtime
19
+ name: equalizer
21
20
  prerelease: false
21
+ type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.0.11
27
27
  - !ruby/object:Gem::Dependency
28
- name: transproc
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - "~>"
30
+ - - ~>
32
31
  - !ruby/object:Gem::Version
33
32
  version: 0.4.0
34
- type: :runtime
33
+ name: transproc
35
34
  prerelease: false
35
+ type: :runtime
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.4.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: hexx-rspec
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
- - - "~>"
44
+ - - ~>
46
45
  - !ruby/object:Gem::Version
47
46
  version: 0.5.2
48
- type: :development
47
+ name: hexx-rspec
49
48
  prerelease: false
49
+ type: :development
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.5.2
55
55
  - !ruby/object:Gem::Dependency
56
- name: ice_nine
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
- - - "~>"
58
+ - - ~>
60
59
  - !ruby/object:Gem::Version
61
60
  version: 0.11.1
62
- type: :development
61
+ name: ice_nine
63
62
  prerelease: false
63
+ type: :development
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.11.1
69
- description:
69
+ description:
70
70
  email: andrew.kozin@gmail.com
71
71
  executables: []
72
72
  extensions: []
@@ -74,13 +74,13 @@ extra_rdoc_files:
74
74
  - README.md
75
75
  - LICENSE
76
76
  files:
77
- - ".coveralls.yml"
78
- - ".gitignore"
79
- - ".metrics"
80
- - ".rspec"
81
- - ".rubocop.yml"
82
- - ".travis.yml"
83
- - ".yardopts"
77
+ - .coveralls.yml
78
+ - .gitignore
79
+ - .metrics
80
+ - .rspec
81
+ - .rubocop.yml
82
+ - .travis.yml
83
+ - .yardopts
84
84
  - CHANGELOG.md
85
85
  - Gemfile
86
86
  - Guardfile
@@ -118,34 +118,33 @@ homepage: https://github.com/nepalez/attributes_dsl
118
118
  licenses:
119
119
  - MIT
120
120
  metadata: {}
121
- post_install_message:
121
+ post_install_message:
122
122
  rdoc_options: []
123
123
  require_paths:
124
124
  - lib
125
125
  required_ruby_version: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - ">="
127
+ - - '>='
128
128
  - !ruby/object:Gem::Version
129
- version: '2.1'
129
+ version: '2.0'
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  requirements:
132
- - - ">="
132
+ - - '>='
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  requirements: []
136
- rubyforge_project:
137
- rubygems_version: 2.4.8
138
- signing_key:
136
+ rubyforge_project:
137
+ rubygems_version: 2.4.5
138
+ signing_key:
139
139
  specification_version: 4
140
140
  summary: Lightweight DSL to define PORO attributes
141
141
  test_files:
142
142
  - spec/spec_helper.rb
143
+ - spec/integration/coerced_attribute_spec.rb
144
+ - spec/integration/blacklisted_attribute_spec.rb
145
+ - spec/integration/unreadable_attribute_spec.rb
143
146
  - spec/integration/required_attribute_spec.rb
144
147
  - spec/integration/unknown_attribute_spec.rb
145
- - spec/integration/simple_attribute_spec.rb
146
- - spec/integration/default_attribute_spec.rb
147
- - spec/integration/unreadable_attribute_spec.rb
148
- - spec/integration/blacklisted_attribute_spec.rb
149
- - spec/integration/coerced_attribute_spec.rb
150
148
  - spec/integration/whitelisted_attribute_spec.rb
151
- has_rdoc:
149
+ - spec/integration/default_attribute_spec.rb
150
+ - spec/integration/simple_attribute_spec.rb