Module: Card::Set::Abstract::Attachment::Paths

Extended by:
Card::Set
Defined in:
platypus/tmp/set/gem-defaults/mod016-carrierwave/abstract/attachment/paths.rb

Overview

Set: Abstract (Attachment, Paths)

Constant Summary

Constants included from Helpers

Helpers::SET_PATTERN_TEST_REGEXP

Constants included from Event::Api

Event::Api::OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Card::Set

reset

Methods included from I18nScope

#mod_name, #scope

Methods included from Registrar

#extended, #finalize_load, #process_base_modules, #register_set

Methods included from Helpers

#format_module, #format_modules, #method_missing, #modules, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscored_name

Methods included from Card::Set::AdvancedApi

#assign_type, #attachment, #define_set_from_error, #ensure_set, #setting_opts, #stage_method

Methods included from Format

#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Trait

#card_accessor, #card_reader, #card_writer, #require_field

Methods included from Event::Api

#event

Class Method Details

.source_locationObject



7
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/abstract/attachment/paths.rb', line 7

def self.source_location; "/Users/ethan/dev/decko/gem/mod/carrierwave/set/abstract/attachment/paths.rb"; end

Instance Method Details

#file_dirObject

used in the identifier



32
33
34
35
36
37
38
39
40
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/abstract/attachment/paths.rb', line 32

def file_dir
  if coded?
    ":#{codename}"
  elsif cloud?
    "(#{bucket})/#{file_id}"
  else
    "~#{file_id}"
  end
end

#file_idObject



46
47
48
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/abstract/attachment/paths.rb', line 46

def file_id
  id? ? id : upload_cache_card.id
end

#files_base_dir(type = "files") ⇒ Object



21
22
23
24
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/abstract/attachment/paths.rb', line 21

def files_base_dir type="files"
  dir = bucket ? bucket_config[:subdirectory] : Card.paths[type].existent.first
  dir || files_base_dir_configuration_error
end

#files_base_dir_configuration_errorObject

Raises:



26
27
28
29
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/abstract/attachment/paths.rb', line 26

def files_base_dir_configuration_error
  raise StandardError,
        "missing directory for file cache (default is `files` in deck root)"
end

#public?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/abstract/attachment/paths.rb', line 42

def public?
  who_can(:read).include? Card::AnyoneID
end

#retrieve_dirObject



12
13
14
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/abstract/attachment/paths.rb', line 12

def retrieve_dir
  coded? ? coded_dir : upload_dir
end

#store_dirObject



8
9
10
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/abstract/attachment/paths.rb', line 8

def store_dir
  coded? ? coded_dir : upload_dir
end

#upload_dirObject

place for files of regular file cards



17
18
19
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/abstract/attachment/paths.rb', line 17

def upload_dir
  id ? "#{files_base_dir}/#{id}" : tmp_upload_dir
end