Module: Card::Set::Type::File::Format

Extended by:
AbstractFormat
Included in:
Image::Format
Defined in:
platypus/tmp/set/gem-defaults/mod016-carrierwave/type/file.rb

Instance Method Summary collapse

Instance Method Details

#handle_sourceObject



40
41
42
43
44
45
46
47
48
49
50
51
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/file.rb', line 40

def handle_source
  rescuing_file_source_error do
    src = source
    if src.blank?
      ""
    elsif block_given?
      yield src
    else
      src
    end
  end
end

#selected_versionObject



58
59
60
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/file.rb', line 58

def selected_version
  card.attachment
end

#short_contentObject



36
37
38
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/file.rb', line 36

def short_content
  number_to_human_size card.attachment.size
end

#sourceObject



53
54
55
56
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/file.rb', line 53

def source
  file = card.attachment
  file.valid? ? contextualize_path(file.url) : ""
end

#view: coreObject



30
31
32
33
34
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/file.rb', line 30

view :core do
  handle_source do |source|
    card_url source
  end
end

#view: sourceObject



26
27
28
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/file.rb', line 26

view :source do
  source
end