awesome_print-carrierwave 0.0.2 → 0.0.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: 35f40f926edbb701ec35e14f67e743ba0c2cd280
4
- data.tar.gz: be1998f43f5e82378bbcd44fd1cbe7351f3282a9
3
+ metadata.gz: 09d8b49cd2a4ff2c7702451695c3130590b70c04
4
+ data.tar.gz: 056dd6ccb62160ee59c7d0cc24ba8b1d76ee9781
5
5
  SHA512:
6
- metadata.gz: bb7a01bd93364fe0447747449a1d01ec9613949db09ed7ad676637172264787d44455cdf9f381200135da29bd7db721901d3d0762e0cac135f3faf3837a6bea7
7
- data.tar.gz: 54e627a800286b6bc6b7d741b81b7fffcc0a527dd31a70004695225bc8e27c5cc0f7e92e14dfa37c6bfdf37d811f42a2d2e554fe4794be345ff77f220b7ce9c0
6
+ metadata.gz: 17c01c232cd0d79cd3ce3208ccd97d23391c9df02bd1e5a61fd3bc0700d38ceed57ba4e7c4ab3ac3071322b8f5ae3a24ecd4e2b4c45ae15dfe0e9d8ccd8b9a6f
7
+ data.tar.gz: f8817f4425a84ba65d11f8b7c61dc9eee72b6e6d881189cae1d753ae4aaa0e8216cc94373f0d0dc8a8a6d00bb3c1f0afc4217fc9a27e576dbed5d48104ef0b05
@@ -1 +1,3 @@
1
- require "awesome_print/carrierwave"
1
+ if defined?(::AwesomePrint::Inspector)
2
+ require "awesome_print/carrierwave" if defined?(CarrierWave) || AwesomePrint.rails_console?
3
+ end
@@ -1,10 +1,11 @@
1
1
  module AwesomePrint
2
- module Carrierwave
2
+ module CarrierWave
3
3
  def self.included(base)
4
4
  base.send :alias_method, :cast_without_carrierwave, :cast
5
5
  base.send :alias_method, :cast, :cast_with_carrierwave
6
6
  end
7
-
7
+
8
+ # Add CarrierWave class names to the dispatcher pipeline.
8
9
  def cast_with_carrierwave(object, type)
9
10
  if defined?(::CarrierWave) && object.is_a?(::CarrierWave::Uploader::Base)
10
11
  :carrierwave_uploader_instance
@@ -12,21 +13,26 @@ module AwesomePrint
12
13
  cast_without_carrierwave(object, type)
13
14
  end
14
15
  end
15
-
16
+
16
17
  private
17
- def awesome_carrierwave_uploader_instance(o)
18
- if defined? ::ActiveSupport::OrderedHash
19
- if @options[:raw]
20
- awesome_object(o)
21
- else
22
- storage_symbol = o.class.storage_engines.key(o._storage.name)
23
- "#{o.class.name} with #{storage_symbol.inspect} " << awesome_hash(o.serializable_hash)
24
- end
18
+
19
+ # Format CarrierWave::Uploader instance object.
20
+ #
21
+ # NOTE: by default only uploader class name, storage and serialiazed
22
+ # versions are shown. To format CarrierWave::Instance instance as
23
+ # regular object showing its instance variables and accessors use
24
+ # <tt>raw: true</tt> option:
25
+ #
26
+ # ap record.uploader, raw: true
27
+ def awesome_carrierwave_uploader_instance(uploader)
28
+ if @options[:raw]
29
+ awesome_object(uploader)
25
30
  else
26
- object.inspect
31
+ "#{uploader.class.name} with #{uploader.class.storage_engines.key(uploader._storage.name)} " \
32
+ << awesome_hash(uploader.serializable_hash)
27
33
  end
28
34
  end
29
35
  end
30
36
  end
31
37
 
32
- AwesomePrint::Formatter.include(AwesomePrint::Carrierwave) if defined?(CarrierWave) && AwesomePrint.rails_console?
38
+ AwesomePrint::Formatter.include(AwesomePrint::CarrierWave)
metadata CHANGED
@@ -1,37 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesome_print-carrierwave
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
  - Tõnis Simo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-14 00:00:00.000000000 Z
11
+ date: 2015-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.3'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.3'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
14
+ name: awesome_print
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
32
18
  - !ruby/object:Gem::Version
33
19
  version: '0'
34
- type: :development
20
+ type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
@@ -67,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
53
  version: '0'
68
54
  requirements: []
69
55
  rubyforge_project:
70
- rubygems_version: 2.4.5
56
+ rubygems_version: 2.4.6
71
57
  signing_key:
72
58
  specification_version: 4
73
59
  summary: AwesomePrint formatter for CarrierWave::Uploader instance objects