usable 3.4.0 → 3.5.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 +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +6 -0
- data/lib/usable/config.rb +6 -3
- data/lib/usable/railtie.rb +7 -0
- data/lib/usable/version.rb +1 -1
- data/lib/usable.rb +6 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfe5fb1828e71f868ce8e7e5b6dd28c53ae83297
|
|
4
|
+
data.tar.gz: c805110e6ce80fe03dd10121a02c4ca4642f0e97
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 38054c2946e9a2a35462955f718a7884dcb62ec6a16e95e44fc17ed7b9a386c52be3fd2a7500b1e2c6603bae0f919426b0c2b4e7a15c3fa0d6f284edd9689793
|
|
7
|
+
data.tar.gz: 60ec033a5d2e7d080ad387e6b564735bf0f24300a413afceb8634b198a3c51e0c3ce2d5c7bc843e052878bcb275cdc1218234d694bfc8d3204dc0b92a64b7a79
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/usable/config.rb
CHANGED
|
@@ -8,11 +8,10 @@ module Usable
|
|
|
8
8
|
include ConfigRegister
|
|
9
9
|
include ConfigMulti
|
|
10
10
|
|
|
11
|
-
# @todo Maybe keep a list of all attributes (lazy and regular)?
|
|
11
|
+
# @todo Maybe keep a list of all attributes (lazy and regular)? e.g @attributes = Set.new attributes.keys.map(&:to_s)
|
|
12
12
|
def initialize(attributes = {})
|
|
13
13
|
@spec = OpenStruct.new(attributes)
|
|
14
14
|
@lazy_loads = Set.new
|
|
15
|
-
# @attributes = Set.new attributes.keys.map(&:to_s)
|
|
16
15
|
end
|
|
17
16
|
|
|
18
17
|
def spec
|
|
@@ -37,13 +36,13 @@ module Usable
|
|
|
37
36
|
end
|
|
38
37
|
|
|
39
38
|
alias to_hash to_h
|
|
39
|
+
alias marshal_dump to_h
|
|
40
40
|
|
|
41
41
|
def merge(other)
|
|
42
42
|
to_h.merge(other)
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def method_missing(key, *args, &block)
|
|
46
|
-
# @attributes << key.to_s
|
|
47
46
|
if block
|
|
48
47
|
@lazy_loads << key
|
|
49
48
|
@spec.define_singleton_method(key) { yield }
|
|
@@ -78,6 +77,10 @@ module Usable
|
|
|
78
77
|
super
|
|
79
78
|
end
|
|
80
79
|
|
|
80
|
+
def marshal_load(attributes = {})
|
|
81
|
+
initialize(attributes)
|
|
82
|
+
end
|
|
83
|
+
|
|
81
84
|
private
|
|
82
85
|
|
|
83
86
|
# @note Handles the case where the value may be defined with a block, in which case it's a method
|
data/lib/usable/version.rb
CHANGED
data/lib/usable.rb
CHANGED
|
@@ -6,6 +6,11 @@ require 'usable/mod_extender'
|
|
|
6
6
|
require 'usable/config'
|
|
7
7
|
|
|
8
8
|
module Usable
|
|
9
|
+
# Keep track of extended classes and modules so we can freeze all usables on boot in production environments
|
|
10
|
+
def self.extended_constants
|
|
11
|
+
@extended_constants ||= Set.new
|
|
12
|
+
end
|
|
13
|
+
|
|
9
14
|
def self.extended(base)
|
|
10
15
|
if base.is_a? Class
|
|
11
16
|
# Define an instance level version of +usables+
|
|
@@ -31,6 +36,7 @@ module Usable
|
|
|
31
36
|
end
|
|
32
37
|
end
|
|
33
38
|
end
|
|
39
|
+
extended_constants << base
|
|
34
40
|
end
|
|
35
41
|
|
|
36
42
|
def usables
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: usable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Buckley
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-01-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -82,6 +82,7 @@ files:
|
|
|
82
82
|
- lib/usable/config_multi.rb
|
|
83
83
|
- lib/usable/config_register.rb
|
|
84
84
|
- lib/usable/mod_extender.rb
|
|
85
|
+
- lib/usable/railtie.rb
|
|
85
86
|
- lib/usable/struct.rb
|
|
86
87
|
- lib/usable/version.rb
|
|
87
88
|
- usable.gemspec
|