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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d81a5e4e8b873e501a781d7f19b22149b7caedf489940d1e6f1b0d706ad8c8af
4
- data.tar.gz: 305cb340bab659c758bff6f3c1b2491a3441e23c78bfff5b94bab7ae266d8529
3
+ metadata.gz: 3df07d5e6ad08b71410d75f82560393c5e5407dd8249e6371aa6a9f472468910
4
+ data.tar.gz: bf442fc2c423e58f789228827a73793e83157bfa4403940eb4660ff11379f922
5
5
  SHA512:
6
- metadata.gz: 5d5093b4bc2372ddfee429f3b58aa7d53010f82c4a954ceece7ec50bae6b1be6103f9916a7a4c8cd10e7e87ce004ebf36795a822afeb3573dd064d09c0222b4a
7
- data.tar.gz: 3b12aae44ac93fba9a4526b8150fae91384cdab05b588524cb302dc1b65bf462c1f6531a8bfd53ad5f72a37e1d60ef225c6ff1c528e4bbb91cf98e5c836cf909
6
+ metadata.gz: 245e2b1ab0a23dc7e35c29e9050b2b7966eda3030f410579022e1c2cbf23101a891a6479b50734e5d3afa9e1c77ac338d67d8a56d4ded8022d196e9414f97fc1
7
+ data.tar.gz: aa448cce429ac8671f8a91fe423475c287cbb29394b748f648b84eccf76e8565d596b60e97570f6bad6480136f00aa3f67042ef2b9658f094c1e813885f5c7a8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bind_url (0.1.1)
4
+ bind_url (0.1.2)
5
5
  activesupport (>= 4.0)
6
6
  aliyun-sdk (> 0.7.0)
7
7
  mimemagic (>= 0.3.0)
@@ -4,6 +4,8 @@ require 'securerandom'
4
4
  require 'pathname'
5
5
  require 'aliyun/oss'
6
6
  require 'rack'
7
+ require "active_support/core_ext/string/inflections"
8
+
7
9
 
8
10
  module BindUrl
9
11
  class Binder
@@ -1,3 +1,3 @@
1
1
  module BindUrl
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "0.1.2".freeze
3
3
  end
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.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-16 00:00:00.000000000 Z
11
+ date: 2021-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport