Class: Parse::Core::EmbedManaged::EmbedDirective

Inherits:
Struct
  • Object
show all
Defined in:
lib/parse/model/core/embed_managed.rb

Overview

Frozen value-object capturing one embed or embed_image declaration. Stored on the owning class under embed_directives[into] and passed to recompute_embedding! from the per-class before_save callback.

modality is nil (treated as :text) for embed-declared directives and :image for embed_image. The image path routes through Parse::Embeddings.validate_image_url! and Provider#embed_image rather than Provider#embed_text; digest tracking is over the file URL String rather than the concatenated source text.

allow_insecure is forwarded to validate_image_url! for image directives only; ignored for text.

source_mode (image directives only) is :url (forward the validated URL to the provider — v5.1 behavior, requires the trust_provider_url_fetch sentinel) or :bytes (the SDK downloads via File.safe_open_url, magic-byte-verifies, EXIF-strips, and forwards base64 — v5.5). exif_strip (default true) applies to :bytes mode only.

meta_field names the :object sibling that records provider/model/dimensions provenance on every recompute — the input ClassMethods#reembed! uses to find stale rows after a model migration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#allow_insecureObject

Returns the value of attribute allow_insecure

Returns:

  • (Object)

    the current value of allow_insecure



124
125
126
# File 'lib/parse/model/core/embed_managed.rb', line 124

def allow_insecure
  @allow_insecure
end

#digest_fieldObject

Returns the value of attribute digest_field

Returns:

  • (Object)

    the current value of digest_field



124
125
126
# File 'lib/parse/model/core/embed_managed.rb', line 124

def digest_field
  @digest_field
end

#exif_stripObject

Returns the value of attribute exif_strip

Returns:

  • (Object)

    the current value of exif_strip



124
125
126
# File 'lib/parse/model/core/embed_managed.rb', line 124

def exif_strip
  @exif_strip
end

#input_typeObject

Returns the value of attribute input_type

Returns:

  • (Object)

    the current value of input_type



124
125
126
# File 'lib/parse/model/core/embed_managed.rb', line 124

def input_type
  @input_type
end

#intoObject

Returns the value of attribute into

Returns:

  • (Object)

    the current value of into



124
125
126
# File 'lib/parse/model/core/embed_managed.rb', line 124

def into
  @into
end

#meta_fieldObject

Returns the value of attribute meta_field

Returns:

  • (Object)

    the current value of meta_field



124
125
126
# File 'lib/parse/model/core/embed_managed.rb', line 124

def meta_field
  @meta_field
end

#modalityObject

Returns the value of attribute modality

Returns:

  • (Object)

    the current value of modality



124
125
126
# File 'lib/parse/model/core/embed_managed.rb', line 124

def modality
  @modality
end

#provider_nameObject

Returns the value of attribute provider_name

Returns:

  • (Object)

    the current value of provider_name



124
125
126
# File 'lib/parse/model/core/embed_managed.rb', line 124

def provider_name
  @provider_name
end

#source_modeObject

Returns the value of attribute source_mode

Returns:

  • (Object)

    the current value of source_mode



124
125
126
# File 'lib/parse/model/core/embed_managed.rb', line 124

def source_mode
  @source_mode
end

#sourcesObject

Returns the value of attribute sources

Returns:

  • (Object)

    the current value of sources



124
125
126
# File 'lib/parse/model/core/embed_managed.rb', line 124

def sources
  @sources
end

Instance Method Details

#bytes_mode?Boolean

Returns:

  • (Boolean)


138
139
140
# File 'lib/parse/model/core/embed_managed.rb', line 138

def bytes_mode?
  source_mode == :bytes
end

#freezeObject



129
130
131
132
# File 'lib/parse/model/core/embed_managed.rb', line 129

def freeze
  sources.freeze
  super
end

#image?Boolean

Returns:

  • (Boolean)


134
135
136
# File 'lib/parse/model/core/embed_managed.rb', line 134

def image?
  modality == :image
end