bind_url 0.1.1 → 0.1.2
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/Gemfile.lock +1 -1
- data/lib/bind_url/binder.rb +2 -0
- data/lib/bind_url/version.rb +1 -1
- data/lib/bind_url.rb +8 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3df07d5e6ad08b71410d75f82560393c5e5407dd8249e6371aa6a9f472468910
|
|
4
|
+
data.tar.gz: bf442fc2c423e58f789228827a73793e83157bfa4403940eb4660ff11379f922
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 245e2b1ab0a23dc7e35c29e9050b2b7966eda3030f410579022e1c2cbf23101a891a6479b50734e5d3afa9e1c77ac338d67d8a56d4ded8022d196e9414f97fc1
|
|
7
|
+
data.tar.gz: aa448cce429ac8671f8a91fe423475c287cbb29394b748f648b84eccf76e8565d596b60e97570f6bad6480136f00aa3f67042ef2b9658f094c1e813885f5c7a8
|
data/Gemfile.lock
CHANGED
data/lib/bind_url/binder.rb
CHANGED
data/lib/bind_url/version.rb
CHANGED
data/lib/bind_url.rb
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
require "bind_url/version"
|
|
2
2
|
require "bind_url/binder"
|
|
3
|
-
require "active_support/all"
|
|
4
3
|
|
|
5
4
|
module BindUrl
|
|
6
5
|
BindUrlConfig = Struct.new(:binder_class, :private, keyword_init: true)
|
|
7
6
|
BucketConfig = Struct.new(:endpoint, :access_key_id, :access_key_secret, :bucket, :host, keyword_init: true)
|
|
8
7
|
class Error < StandardError; end
|
|
9
8
|
|
|
10
|
-
def bind_url(attr, binder_class, private: false)
|
|
9
|
+
def bind_url(attr, binder_class: BindUrl.default_binder_class, private: false)
|
|
11
10
|
bind_url_configs[attr.to_sym] = BindUrlConfig.new(binder_class: binder_class, private: private)
|
|
12
11
|
|
|
13
12
|
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
@@ -32,7 +31,7 @@ module BindUrl
|
|
|
32
31
|
RUBY
|
|
33
32
|
end
|
|
34
33
|
|
|
35
|
-
def bind_urls(attr, binder_class, private: false)
|
|
34
|
+
def bind_urls(attr, binder_class: BindUrl.default_binder_class, private: false)
|
|
36
35
|
bind_url_configs[attr.to_sym] = BindUrlConfig.new(binder_class: binder_class, private: private)
|
|
37
36
|
|
|
38
37
|
signle_attr = attr.to_s.singularize.to_sym
|
|
@@ -78,12 +77,18 @@ module BindUrl
|
|
|
78
77
|
|
|
79
78
|
class << self
|
|
80
79
|
attr_accessor :storage_configs
|
|
80
|
+
attr_writer :default_binder_class
|
|
81
81
|
|
|
82
82
|
def configure(storage = :default)
|
|
83
83
|
config = BindUrl::BucketConfig.new
|
|
84
84
|
yield config
|
|
85
85
|
storage_configs[storage] = config
|
|
86
86
|
end
|
|
87
|
+
|
|
88
|
+
def default_binder_class
|
|
89
|
+
raise "you need overwrite BindUrl.default_binder_class" if @default_binder_class.nil?
|
|
90
|
+
@default_binder_class
|
|
91
|
+
end
|
|
87
92
|
end
|
|
88
93
|
end
|
|
89
94
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bind_url
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- xuxiangyang
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-12-
|
|
11
|
+
date: 2021-12-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|