class ElFinder2::Command::Tmb

Public Instance Methods

execute() click to toggle source
# File lib/el_finder2/command/tmb.rb, line 4
def execute
  images = @targets.inject({}) do |hash, image|
    hash[image.path_hash] = image.url(:thumb)
  end

  render json: { images: images }
end

Private Instance Methods

parse_params!(params) click to toggle source
# File lib/el_finder2/command/tmb.rb, line 12
        def parse_params!(params)
  targets = params[:targets]
  fail ElFinder2::Error.new(%w(errCmdParams tmb)) unless targets.present?

  @targets = targets.
    map(&method(:to_path)).
    map(&ElFinder2::Image.method(:find_by_path)).
    compact
end