paperclip-eitheror 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0eaac3a917d3a5ec24a54f230ea46087167b9dde
4
- data.tar.gz: 936ba75f84bcb492118e25230f8374bfe5fb2f5a
3
+ metadata.gz: 30eaf33665bded688d140b411866ebd3e8001cd4
4
+ data.tar.gz: e9bd11dfcc2c6d3ee834cdda13fc81e524b18cd0
5
5
  SHA512:
6
- metadata.gz: 98b2c8152ec72ce8e98dd0d9ae828b6445c764715348de5c6308331498d18895f413d43ceb18112dc516c08becc0ab95f7df2f6d8ee2291f4a37b4346d30d7eb
7
- data.tar.gz: c4ae600bb32c35013922744768feff5ef47994be28479f633df03dccf9932b96b6df3c27abc79187354b5ff98b0aeb732a45fea81f3da1f32c2eb683d9dd66da
6
+ metadata.gz: fbcc67e71153a54d4823056d473cdc145152f5351b6f0f4664ada122ed1c9d3067a8ff6c7e5eadedfd769576e286a324d02642d5a71d3158b9676cf78cf1e7f9
7
+ data.tar.gz: 0e75e76b3e57bc0c78dd1165cbed4921648106f85899c8d32db2194de9c5bf5ae351d084792339702e2f7ce8703d5daecd7172d82a532396ba7338cadd1ad4c2
@@ -1,5 +1,5 @@
1
1
  module Paperclip
2
2
  module Eitheror
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  module Paperclip
2
2
  module Storage
3
3
  module Eitheror
4
- def self.extended base
4
+ def self.extended(base)
5
5
  base.instance_eval do
6
6
  base.options[:either][:enabled] = true if base.options[:either][:enabled].nil?
7
7
  @either = Attachment.new(base.name, base.instance, base.options.merge(base.options[:either]))
@@ -65,7 +65,17 @@ module Paperclip
65
65
  usable_storage.send(method, *args)
66
66
  end
67
67
 
68
+ def either_enabled?
69
+ callable_option(@either, :enabled)
70
+ end
71
+
68
72
  private
73
+
74
+ def callable_option(attachment, key)
75
+ option = attachment.options[key]
76
+ option.respond_to?(:call) ? option.call(attachment) : option
77
+ end
78
+
69
79
  def all_storages
70
80
  [@either, @or]
71
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-eitheror
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matheus Abegg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-01 00:00:00.000000000 Z
11
+ date: 2016-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paperclip
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  requirements: []
149
149
  rubyforge_project:
150
- rubygems_version: 2.4.8
150
+ rubygems_version: 2.4.5.1
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: Storage for Paperclip which will fallback in case of a file not existing