korgi 0.2.2 → 0.2.3

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: 050e5bb1bab1f7c286154c1c1100e0f5a8bcf268
4
- data.tar.gz: dbe4c158ab61265306ac2d43342be42232534363
3
+ metadata.gz: e278324bb06eb18630adcb51bfc63975cd95b7e8
4
+ data.tar.gz: cf39464e72e46331c4e2b24bab6366d9085a9360
5
5
  SHA512:
6
- metadata.gz: 272aabc24cb3f2de3815655a3c658e9c745c04bd8b16a2b7ee2c139669a9b10b5eedd083563eb7b1670115c2b4e93b0639b1459663da976b656fccf38bc60d9b
7
- data.tar.gz: 18951b599032c7238fbaed538c85cdba45d29d7a1dada65ce9da3d43effb34a5cb961af4a69c386fd242d5de6c72118d63a9607fcc7ec794b56556dea34cc0c8
6
+ metadata.gz: d97bcce077c0827cb62be7a125b5c322689759ab87ab42f26b6f36a94b7c2720dc1bf62eb2ad95ea52893331d30fc6171a6636573ad774cbb655202a4fdd93bb
7
+ data.tar.gz: 36169693edc1c22f88e237daacc74e2fe1f4e994087195bf651b5831e97d3a69b6199562f158581eea6e610433c3d8bfb0d9adcd35c3e4059061e98b28391eda
data/README.md CHANGED
@@ -24,12 +24,18 @@ $+image.1$
24
24
  ```
25
25
  # config/initializers/korgi.rb
26
26
  Korgi.configure do |config|
27
- config.file_uploads = { image: { model: Image, mount: :file, default_version: :thumb } }
27
+ config.file_uploads = { image: { model: :Image, mount: :file, default_version: :thumb }
28
28
  end
29
29
  ```
30
30
 
31
31
  This tells *korgi* that you have a CarrierWave uploader mounted to `Image` on `:file`, with `:thumb` as its default version. You can then simply write `$+image.1$` or `$+image.1.large$` in your markdown input, and *korgi* will replace the syntax with the associated url (and version).
32
32
 
33
+ If you are using a [Null Object Pattern](https://robots.thoughtbot.com/rails-refactoring-example-introduce-null-object), you can also set an optional `nil_object` for unavailable files to fallback for:
34
+
35
+ ```
36
+ image: { ..., nil_object: :NullImage }
37
+ ```
38
+
33
39
  If you need the full url instead, you should change the settings for CarrierWave:
34
40
 
35
41
  ```
@@ -66,7 +72,7 @@ In Rails speak, this means that *korgi* will replace `$#post.1$` with the resul
66
72
  ```
67
73
  # config/initializers/korgi.rb
68
74
  Korgi.configure do |config|
69
- config.named_routes = { post: { controller: :posts, model: Post, primary_key: :slug } }
75
+ config.named_routes = { post: { controller: :posts, model: :Post, primary_key: :slug } }
70
76
  end
71
77
  ```
72
78
 
@@ -36,7 +36,7 @@ module Korgi
36
36
  end
37
37
 
38
38
  def klass
39
- configured_value(:model)
39
+ Object.const_get(configured_value(:model))
40
40
  end
41
41
 
42
42
  def mount
@@ -44,7 +44,7 @@ module Korgi
44
44
  end
45
45
 
46
46
  def nil_object
47
- configured_value(:nil_object)
47
+ Object.const_get(configured_value(:nil_object))
48
48
  end
49
49
 
50
50
  def default_version
@@ -52,7 +52,7 @@ module Korgi
52
52
  end
53
53
 
54
54
  def klass
55
- configured_value(:model)
55
+ Object.const_get(configured_value(:model))
56
56
  end
57
57
 
58
58
  def primary_key
data/lib/korgi/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Korgi
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: korgi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tsehau Chao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-24 00:00:00.000000000 Z
11
+ date: 2018-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails