Module: CarrierWave::Uploader::Serialization
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base
- Defined in:
- lib/carrierwave/uploader/serialization.rb
Instance Method Summary collapse
- #as_json(options = nil) ⇒ Object
- #serializable_hash(options = nil) ⇒ Object
- #to_json(options = nil) ⇒ Object
- #to_xml(options = {}) ⇒ Object
Instance Method Details
#as_json(options = nil) ⇒ Object
13 14 15 |
# File 'lib/carrierwave/uploader/serialization.rb', line 13 def as_json(=nil) serializable_hash end |
#serializable_hash(options = nil) ⇒ Object
9 10 11 |
# File 'lib/carrierwave/uploader/serialization.rb', line 9 def serializable_hash( = nil) {"url" => url}.merge Hash[versions.map { |name, version| [name.to_s, { "url" => version.url }] }] end |
#to_json(options = nil) ⇒ Object
17 18 19 |
# File 'lib/carrierwave/uploader/serialization.rb', line 17 def to_json(=nil) JSON.generate(as_json) end |
#to_xml(options = {}) ⇒ Object
21 22 23 24 |
# File 'lib/carrierwave/uploader/serialization.rb', line 21 def to_xml(={}) = .merge(:root => mounted_as || "uploader", :type => 'uploader') serializable_hash.to_xml() end |