evt-set_attributes 0.1.1.2 → 0.2.0.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7fe99a06d22cde1dbcf74bb61fd46a5caf0da64
|
4
|
+
data.tar.gz: 5d432c8209700b6bcdb1e2b7ebb87e59501fd279
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9935e14c5c443074c702913863935e21fb054553b60d6cdb24c7fc32272ea3db8badf7bddc4c27b73fa73cedb405b5dbe12cd6d1db8b8cb057a4c3dd4769f7f6
|
7
|
+
data.tar.gz: 130a42559076ad1c36594641fc3b89b46d7a015e9a2aa623525855574cd9dcf5cf6992cd51a0bc9694d85791c301dae4be618ed9fda2474df66cffd2bd7eae85
|
@@ -3,8 +3,6 @@ class SetAttributes
|
|
3
3
|
class Error < RuntimeError; end
|
4
4
|
|
5
5
|
def self.set(receiver, attribute, value, strict: nil)
|
6
|
-
logger = Telemetry::Logger.build self
|
7
|
-
|
8
6
|
strict ||= false
|
9
7
|
|
10
8
|
setter = :"#{attribute}="
|
@@ -14,10 +12,7 @@ class SetAttributes
|
|
14
12
|
else
|
15
13
|
if strict
|
16
14
|
error_msg = "#{receiver} has no setter for #{attribute}"
|
17
|
-
logger.error error_msg
|
18
15
|
raise Error, error_msg
|
19
|
-
else
|
20
|
-
logger.opt_debug "#{receiver} has no setter for #{attribute}"
|
21
16
|
end
|
22
17
|
end
|
23
18
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class SetAttributes
|
2
|
+
module Controls
|
3
|
+
module Hash
|
4
|
+
def self.example
|
5
|
+
Controls::Object.example.to_h
|
6
|
+
end
|
7
|
+
|
8
|
+
module MissingAttribute
|
9
|
+
def self.example
|
10
|
+
example = Hash.example
|
11
|
+
example.delete(:yet_another_attribute)
|
12
|
+
example
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Example = Struct.new(
|
17
|
+
:some_attribute,
|
18
|
+
:some_other_attribute,
|
19
|
+
:yet_another_attribute
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
class SetAttributes
|
2
|
+
module Controls
|
3
|
+
module Object
|
4
|
+
def self.example
|
5
|
+
example = Example.new
|
6
|
+
|
7
|
+
example.some_attribute = some_attribute
|
8
|
+
example.some_other_attribute = some_other_attribute
|
9
|
+
example.yet_another_attribute = yet_another_attribute
|
10
|
+
|
11
|
+
example
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.some_attribute
|
15
|
+
'some value'
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.some_other_attribute
|
19
|
+
'some other value'
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.yet_another_attribute
|
23
|
+
'yet another value'
|
24
|
+
end
|
25
|
+
|
26
|
+
Example = Struct.new(
|
27
|
+
:some_attribute,
|
28
|
+
:some_other_attribute,
|
29
|
+
:yet_another_attribute
|
30
|
+
)
|
31
|
+
|
32
|
+
module New
|
33
|
+
def self.example
|
34
|
+
Object::Example.new
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
module MissingAttribute
|
39
|
+
def self.example
|
40
|
+
example = Example.new
|
41
|
+
|
42
|
+
example.some_attribute = Object.some_attribute
|
43
|
+
example.some_other_attribute = Object.some_other_attribute
|
44
|
+
|
45
|
+
example
|
46
|
+
end
|
47
|
+
|
48
|
+
Example = Struct.new(
|
49
|
+
:some_attribute,
|
50
|
+
:some_other_attribute,
|
51
|
+
)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -1,6 +1,4 @@
|
|
1
1
|
class SetAttributes
|
2
|
-
dependency :logger, Telemetry::Logger
|
3
|
-
|
4
2
|
attr_reader :receiver
|
5
3
|
attr_reader :data
|
6
4
|
attr_writer :include
|
@@ -50,7 +48,6 @@ class SetAttributes
|
|
50
48
|
instance.include = include
|
51
49
|
instance.exclude = exclude
|
52
50
|
instance.strict = strict
|
53
|
-
Telemetry::Logger.configure instance
|
54
51
|
end
|
55
52
|
end
|
56
53
|
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evt-set_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Eventide Project
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: evt-telemetry-logger
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: test_bench
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -46,6 +32,9 @@ extra_rdoc_files: []
|
|
46
32
|
files:
|
47
33
|
- lib/set_attributes.rb
|
48
34
|
- lib/set_attributes/attribute.rb
|
35
|
+
- lib/set_attributes/controls.rb
|
36
|
+
- lib/set_attributes/controls/hash.rb
|
37
|
+
- lib/set_attributes/controls/object.rb
|
49
38
|
- lib/set_attributes/set_attributes.rb
|
50
39
|
homepage: https://github.com/eventide-project/set-attributes
|
51
40
|
licenses:
|
@@ -67,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
56
|
version: '0'
|
68
57
|
requirements: []
|
69
58
|
rubyforge_project:
|
70
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.6.8
|
71
60
|
signing_key:
|
72
61
|
specification_version: 4
|
73
62
|
summary: Set an object's attributes from an object or hash with a similar attributes
|