tablesalt 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tablesalt/version.rb +1 -1
- data/lib/tablesalt.rb +0 -2
- metadata +2 -3
- data/lib/tablesalt/dsl/defaults.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b748decee67357032513760ef56652e9cd510eaae1bb247bbcb19c2978ee133c
|
4
|
+
data.tar.gz: c1a25d82211fd442579c0171ae6d0b9c08ad8c64c2901ce974c4a33445c9427c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11c47d79acf5c10bb19dc6f3e9948b56fcdb894fbb46a8b270610b3c50a74a7f62202bd0ef7560898d272160822157fd14eb86fde8fe619b355f462c39191fd9
|
7
|
+
data.tar.gz: 51c11940f31b4ae3cf713a2184992ec0f58a2543df4f3a061fc349c6c334d6628e22f998ce92f735db0be5f8b39f717b627da68db0e5e65ef0cef21bed8eb7a9
|
data/lib/tablesalt/version.rb
CHANGED
data/lib/tablesalt.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "active_support"
|
4
|
-
require "active_support/core_ext/class/attribute"
|
5
4
|
require "short_circu_it"
|
6
5
|
|
7
6
|
require "tablesalt/version"
|
8
7
|
|
9
|
-
require "tablesalt/dsl/defaults"
|
10
8
|
require "tablesalt/stringable_object"
|
11
9
|
|
12
10
|
module Tablesalt; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tablesalt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Minneti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -49,7 +49,6 @@ files:
|
|
49
49
|
- LICENSE.txt
|
50
50
|
- README.md
|
51
51
|
- lib/tablesalt.rb
|
52
|
-
- lib/tablesalt/dsl/defaults.rb
|
53
52
|
- lib/tablesalt/stringable_object.rb
|
54
53
|
- lib/tablesalt/version.rb
|
55
54
|
homepage: https://github.com/Freshly/spicerack/tree/master/tablesalt
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Defaults allow for storing values to use when none are specified by the developer.
|
4
|
-
module Tablesalt
|
5
|
-
module Dsl
|
6
|
-
module Defaults
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
included do
|
10
|
-
class_attribute :_defaults, instance_writer: false, default: {}
|
11
|
-
end
|
12
|
-
|
13
|
-
class_methods do
|
14
|
-
def inherited(base)
|
15
|
-
dup = _defaults.dup
|
16
|
-
base._defaults = dup.each { |k, v| dup[k] = v.dup }
|
17
|
-
super
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def define_default(attribute, static: nil, &block)
|
23
|
-
_defaults[attribute] = Value.new(static: static, &block)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
class Value
|
28
|
-
def initialize(static: nil, &block)
|
29
|
-
@value = (static.nil? && block_given?) ? block : static
|
30
|
-
end
|
31
|
-
|
32
|
-
def value
|
33
|
-
(@value.respond_to?(:call) ? instance_eval(&@value) : @value).dup
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|