Module: Card::Set::Type::Image::Format

Extended by:
AbstractFormat
Includes:
File::Format
Defined in:
platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb

Instance Method Summary collapse

Methods included from File::Format

#handle_source, #view: core

Instance Method Details

#closed_sizeObject



52
53
54
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 52

def closed_size
  :icon
end

#default_sizeObject



60
61
62
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 60

def default_size
  :medium
end

#determine_image_sizeObject



64
65
66
67
68
69
70
71
72
73
74
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 64

def determine_image_size
  voo.size =
    case
    when nest_mode == :closed then closed_size
    when voo.size.present?    then voo.size.to_sym
    when main?                then main_size
    else                           default_size
    end
  voo.size = :original if voo.size == :full
  voo.size
end

#main_sizeObject



56
57
58
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 56

def main_size
  :large
end

#selected_versionObject



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

def selected_version
  size = determine_image_size
  image = card.image

  if size && size != :original && !svg?
    image.versions[size]
  else
    image
  end
end

#short_contentObject



28
29
30
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 28

def short_content
  render_core size: :icon
end

#view: inlineObject



76
77
78
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 76

view :inline do
  _render_core
end

#view: one_line_contentObject



24
25
26
# File 'platypus/tmp/set/gem-defaults/mod016-carrierwave/type/image.rb', line 24

view :one_line_content do
  _render_core size: :icon
end

#view: sourceObject



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

view :source, unknown: :blank do
  return card.content if card.web?

  image = selected_version
  return "" unless image.valid?

  contextualize_path image.url
end