refile_images 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: 743a3da9fe0259af007fe4726ba188f978d9e4d5
4
- data.tar.gz: e97c66532b11bf2b770b2f8f3ab35279f4daa89d
3
+ metadata.gz: 9dd1635a7a06726fd24becb089673870e4e58436
4
+ data.tar.gz: 31cb361ea5ecfb87853205869977da9f97111591
5
5
  SHA512:
6
- metadata.gz: 2d18a24169a25aec4ed44195e93dc8874065987c303d5782c6000b67b2621765a41e22658d56e03bf5f5c5a50d212c3b4b3a582a417d345feb258cd717bcc386
7
- data.tar.gz: 2fdfbc44ad2a94e39cf42e28e6f7b8846f0d51b8ed9dc13839735cb3f1768730f3177738b97e6980bbee645425ba2b837eccc4627f50105ace19e5abe348acf1
6
+ metadata.gz: eb7da098860a48eccb90ea7b88714f0501bb7b62d916c94dc757b8aab726b03a3fa09d9605bdcbc0fed9b9b0d35e92966563596d4e35263b3e4d0a574c5ebbc6
7
+ data.tar.gz: 5f4760b8139f7814d7e0f16850494117f2115b949b7eaf0e7e7ba0d8f8fbf7116a71d45abd92bd6c60ba0e0a8790ad5ab5f7face03ab5ef082bbda81dfaa43f1
data/app/models/image.rb CHANGED
@@ -7,4 +7,30 @@ class Image < ActiveRecord::Base
7
7
  def url(size, *options)
8
8
  imageable.get_url(self, size, *options)
9
9
  end
10
+
11
+
12
+ # Generate a custom image URL.
13
+ #
14
+ # If the filename option is not given, the filename is taken from the
15
+ # metadata stored in the attachment, or eventually falls back to the
16
+ # `name`.
17
+ #
18
+ # The host defaults to {Refile.cdn_host}, which is useful for serving all
19
+ # attachments from a CDN. You can also override the host via the `host`
20
+ # option.
21
+ #
22
+ # @example original image url
23
+ # image.custom_url
24
+ #
25
+ # @example With custom params
26
+ # image.attachment_url(:fill, 300, 300, format: :jpg, filename: "awesome")
27
+ #
28
+ # @param [String, nil] filename The filename to be appended to the URL
29
+ # @param [String, nil] format A file extension to be appended to the URL
30
+ # @param [String, nil] host Override the host
31
+ # @param [String, nil] prefix Adds a prefix to the URL if the application is not mounted at root
32
+ # @return [String, nil] The generated URL
33
+ def custom_url(*args, **options)
34
+ Refile.attachment_url(self, :file, *args, **options)
35
+ end
10
36
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module RefileImages
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refile_images
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Barragán
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-07 00:00:00.000000000 Z
11
+ date: 2016-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails