Module: Card::Set::Abstract::Attachment::Paths
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod015-carrierwave/abstract/attachment/paths.rb
Constant Summary collapse
- MOD_FILE_DIR =
~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/carrierwave/set/abstract/attachment/paths.rb ~~
"file".freeze
Constants included from Format
Instance Method Summary collapse
-
#coded_dir(new_mod = nil) ⇒ Object
place for files of mod file cards.
-
#file_dir ⇒ Object
used in the indentifier.
- #file_id ⇒ Object
- #files_base_dir ⇒ Object
- #mod_dir(new_mod = nil) ⇒ Object
- #public? ⇒ Boolean
- #retrieve_dir ⇒ Object
- #store_dir ⇒ Object
-
#upload_dir ⇒ Object
place for files of regular file cards.
Methods included from I18nScope
Methods included from Loader
#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set
Methods included from Helpers
#abstract_set?, #all_set?, #num_set_parts, #shortname, #underscore
Methods included from Card::Set::AdvancedApi
#attachment, #ensure_set, #stage_method
Methods included from Format
#all_set_format_mod!, #before, #define_on_format, #format, layout_method_name, #register_set_format, #view, #view_for_override, view_method_name, wrapper_method_name
Methods included from Inheritance
#include_set, #include_set_formats
Methods included from Basket
#abstract_basket, #add_to_basket, #basket
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
Instance Method Details
#coded_dir(new_mod = nil) ⇒ Object
place for files of mod file cards
20 21 22 23 24 |
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/paths.rb', line 20 def coded_dir new_mod=nil dir = File.join mod_dir(new_mod), MOD_FILE_DIR, codename FileUtils.mkdir_p dir dir end |
#file_dir ⇒ Object
used in the indentifier
37 38 39 40 41 42 43 44 45 |
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/paths.rb', line 37 def file_dir if coded? ":#{codename}" elsif cloud? "(#{bucket})/#{file_id}" else "~#{file_id}" end end |
#file_id ⇒ Object
51 52 53 |
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/paths.rb', line 51 def file_id id? ? id : upload_cache_card.id end |
#files_base_dir ⇒ Object
32 33 34 |
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/paths.rb', line 32 def files_base_dir bucket ? bucket_config[:subdirectory] : Card.paths["files"].existent.first end |
#mod_dir(new_mod = nil) ⇒ Object
26 27 28 29 30 |
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/paths.rb', line 26 def mod_dir new_mod=nil find_mod = new_mod || mod Card::Mod::Loader.mod_dirs.path(find_mod) || raise(Error, "can't find mod \"#{find_mod}\"") end |
#public? ⇒ Boolean
47 48 49 |
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/paths.rb', line 47 def public? who_can(:read).include? Card[:anyone].id end |
#retrieve_dir ⇒ Object
10 11 12 |
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/paths.rb', line 10 def retrieve_dir coded? ? coded_dir : upload_dir end |
#store_dir ⇒ Object
6 7 8 |
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/paths.rb', line 6 def store_dir will_become_coded? ? coded_dir(@new_mod) : upload_dir end |
#upload_dir ⇒ Object
place for files of regular file cards
15 16 17 |
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/paths.rb', line 15 def upload_dir id ? "#{files_base_dir}/#{id}" : tmp_upload_dir end |