Class: Studio::EmailCatalog::Entry

Inherits:
Struct
  • Object
show all
Defined in:
app/services/studio/email_catalog.rb

Overview

A registered email. default_asset — logical asset path inside the gem (resolved through the host's pipeline); nil means no inherited artwork. type — :transactional or :marketing. preview — callable returning a Mail, or nil.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aspect_ratioObject

Returns the value of attribute aspect_ratio

Returns:

  • (Object)

    the current value of aspect_ratio



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def aspect_ratio
  @aspect_ratio
end

#backgroundObject

Returns the value of attribute background

Returns:

  • (Object)

    the current value of background



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def background
  @background
end

#default_assetObject

Returns the value of attribute default_asset

Returns:

  • (Object)

    the current value of default_asset



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def default_asset
  @default_asset
end

#default_originObject

Returns the value of attribute default_origin

Returns:

  • (Object)

    the current value of default_origin



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def default_origin
  @default_origin
end

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def description
  @description
end

#headerObject

Returns the value of attribute header

Returns:

  • (Object)

    the current value of header



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def header
  @header
end

#header_fallbackObject

Returns the value of attribute header_fallback

Returns:

  • (Object)

    the current value of header_fallback



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def header_fallback
  @header_fallback
end

#keyObject

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def key
  @key
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def label
  @label
end

#logoObject

Returns the value of attribute logo

Returns:

  • (Object)

    the current value of logo



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def 
  @logo
end

#previewObject

Returns the value of attribute preview

Returns:

  • (Object)

    the current value of preview



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def preview
  @preview
end

#scrimObject

Returns the value of attribute scrim

Returns:

  • (Object)

    the current value of scrim



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def scrim
  @scrim
end

#subjectObject

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def subject
  @subject
end

#subtextObject

Returns the value of attribute subtext

Returns:

  • (Object)

    the current value of subtext



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def subtext
  @subtext
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



82
83
84
# File 'app/services/studio/email_catalog.rb', line 82

def type
  @type
end

Instance Method Details

#engine_artwork?Boolean

WHOSE artwork default_asset names. Recorded at registration rather than inferred later: by the time the page asks, a resolved asset path looks identical whether the file came from the gem or from the host, and guessing from the path is exactly the wrong-answer machine this exists to remove. The engine seeds its own two as :engine; anything a host passes default_asset for is that host's own.

Returns:

  • (Boolean)


97
# File 'app/services/studio/email_catalog.rb', line 97

def engine_artwork? = default_origin.to_s != "app"

#marketing?Boolean

nil-safe: an Entry built directly (the STANDARD seed) may carry no type.

Returns:

  • (Boolean)


89
# File 'app/services/studio/email_catalog.rb', line 89

def marketing? = type.to_s == "marketing"

#previewable?Boolean

Returns:

  • (Boolean)


87
88
# File 'app/services/studio/email_catalog.rb', line 87

def previewable? = preview.respond_to?(:call)
# nil-safe: an Entry built directly (the STANDARD seed) may carry no type.

#ratioObject

The shape of THIS email's banner — the box the page draws and the ratio the upload cropper enforces. Per-entry because the engine's own artwork is 3:1 while turf-monster's eight banners are 2:1; one global constant would letterbox one app's art and crop the other's on every upload.



103
# File 'app/services/studio/email_catalog.rb', line 103

def ratio = (aspect_ratio || ASPECT_RATIO).to_f

#to_sObject



86
# File 'app/services/studio/email_catalog.rb', line 86

def to_s = key