Module: ActiveFile::MultipleFiles

Included in:
Base
Defined in:
lib/active_file/multiple_files.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.full_pathsObject



18
19
20
21
22
23
24
25
26
# File 'lib/active_file/multiple_files.rb', line 18

def self.full_paths
  if filenames.present?
    filenames.collect do |filename|
      File.join(actual_root_path, "#{filename}.#{extension}")
    end
  else
    [full_path]
  end
end

.multiple_files?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/active_file/multiple_files.rb', line 14

def self.multiple_files?
  true
end

.set_filenames(*filenames) ⇒ Object



10
11
12
# File 'lib/active_file/multiple_files.rb', line 10

def self.set_filenames(*filenames)
  self.filenames = filenames
end

Instance Method Details

#multiple_files?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/active_file/multiple_files.rb', line 3

def multiple_files?
  false
end

#use_multiple_filesObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/active_file/multiple_files.rb', line 7

def use_multiple_files
  class_attribute :filenames, instance_reader: false, instance_writer: false

  def self.set_filenames(*filenames)
    self.filenames = filenames
  end

  def self.multiple_files?
    true
  end

  def self.full_paths
    if filenames.present?
      filenames.collect do |filename|
        File.join(actual_root_path, "#{filename}.#{extension}")
      end
    else
      [full_path]
    end
  end
end