usable 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/lib/usable/version.rb +1 -1
- data/lib/usable.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 302091dea6e4c83d5b143e02ff10f6f04d242750
|
4
|
+
data.tar.gz: c5106c2329acd29b966f8a166de811fe5e9dfc03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fa5f3463f1fa6c23114e04fa5fbed769c788026614d00758975c73dce0bce3df6637de41dcc99efaec48aed30396882581d348d581f01185573d11f948ea754
|
7
|
+
data.tar.gz: 4375b84ab60d8f7f3c5b52432743815d2cf1943a571c5aa4e9729c346c34984de9c788e5f4fecdf20551b7d036b066870d536a517ad5b7b6ef4141fcf6477010
|
data/README.md
CHANGED
@@ -6,11 +6,11 @@ available to both the module and including class. Allows you to include only the
|
|
6
6
|
```ruby
|
7
7
|
module VersionMixin
|
8
8
|
extend Usable
|
9
|
-
|
10
|
-
|
9
|
+
config.max_versions = 25
|
10
|
+
config.table_name = 'versions'
|
11
11
|
|
12
12
|
def save_version
|
13
|
-
"Saving
|
13
|
+
"Saving #{usables.max_versions} #{usables.table_name}"
|
14
14
|
end
|
15
15
|
|
16
16
|
def destroy_version
|
@@ -23,7 +23,6 @@ class Model
|
|
23
23
|
|
24
24
|
usable VersionMixin, only: :save_version do
|
25
25
|
max_versions 10
|
26
|
-
table_name 'custom_versions'
|
27
26
|
end
|
28
27
|
|
29
28
|
def save
|
@@ -32,7 +31,7 @@ class Model
|
|
32
31
|
end
|
33
32
|
|
34
33
|
model = Model.new
|
35
|
-
model.save_version # => "Saving
|
34
|
+
model.save_version # => "Saving 10 versions"
|
36
35
|
model.destroy_version # => NoMethodError: undefined method `destroy_version' for #<Model:...
|
37
36
|
```
|
38
37
|
`Model` now has a `#save_versions` method but no `#destroy_version` method. Usable has effectively mixed in the given module
|
@@ -93,7 +92,8 @@ Model.usable_method(model, :destroy_version).call # => nil
|
|
93
92
|
|
94
93
|
Modules with the following names found within the target module's namespace will be automatically used.
|
95
94
|
|
96
|
-
`ClassMethods`
|
95
|
+
* `ClassMethods`
|
96
|
+
* `InstanceMethods`
|
97
97
|
|
98
98
|
## Notes
|
99
99
|
|
data/lib/usable/version.rb
CHANGED
data/lib/usable.rb
CHANGED
@@ -68,8 +68,8 @@ module Usable
|
|
68
68
|
[scope, usables].each { |x| options.each { |k, v| x[k] = v } }
|
69
69
|
[scope, usables].each { |x| x.instance_eval &block } if block_given?
|
70
70
|
ModExtender.new(mod, usable_options).call self
|
71
|
-
send :include, mod.const_get(:InstanceMethods) if const_defined?
|
72
|
-
send :extend, mod.const_get(:ClassMethods) if const_defined?
|
71
|
+
send :include, mod.const_get(:InstanceMethods) if mod.const_defined?(:InstanceMethods)
|
72
|
+
send :extend, mod.const_get(:ClassMethods) if mod.const_defined?(:ClassMethods)
|
73
73
|
self
|
74
74
|
end
|
75
75
|
|
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: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Buckley
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|