class ElFinder2::Command::Size
Returns the size of a directory or file.
Public Instance Methods
execute()
click to toggle source
Response:
size: The total size for all the supplied targets.
# File lib/el_finder2/command/size.rb, line 9 def execute size = @targets.sum(&:size) render json: { size: size } end
Private Instance Methods
parse_params!(params)
click to toggle source
Arguments:
cmd : size targets[] : hash paths of the nodes
# File lib/el_finder2/command/size.rb, line 18 def parse_params!(params) targets = params[:targets] fail ElFinder2::Error.new(%w(errCmdParams size)) unless targets.present? @targets = targets. map(&method(:to_path)). map(&ElFinder2::File.method(:find_by_path)). compact end