Method: EmbeddedFile::Loader#call
- Defined in:
- lib/asker/loader/embedded_file/loader.rb
#call(value, localdir) ⇒ Object
Returns Hash.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/asker/loader/embedded_file/loader.rb', line 15 def call(value, localdir) filepath = File.join(localdir, value) type = EmbebbedFile::Type.new.for(value, localdir) case type when :image return load_image(value, localdir) when :image_url return load_image_url(value, localdir) when :audio return load_audio(value, localdir) when :audio_url return load_audio_url(value, localdir) when :video return load_video(value, localdir) when :video_url return load_video_url(value, localdir) end { text: "<pre>#{File.read(filepath)}</pre>", file: :none, type: :text, url: value } end |