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.

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



106
107
108
# File 'lib/parse/model/core/embed_managed.rb', line 106

def allow_insecure
  @allow_insecure
end

#digest_fieldObject

Returns the value of attribute digest_field

Returns:

  • (Object)

    the current value of digest_field



106
107
108
# File 'lib/parse/model/core/embed_managed.rb', line 106

def digest_field
  @digest_field
end

#input_typeObject

Returns the value of attribute input_type

Returns:

  • (Object)

    the current value of input_type



106
107
108
# File 'lib/parse/model/core/embed_managed.rb', line 106

def input_type
  @input_type
end

#intoObject

Returns the value of attribute into

Returns:

  • (Object)

    the current value of into



106
107
108
# File 'lib/parse/model/core/embed_managed.rb', line 106

def into
  @into
end

#modalityObject

Returns the value of attribute modality

Returns:

  • (Object)

    the current value of modality



106
107
108
# File 'lib/parse/model/core/embed_managed.rb', line 106

def modality
  @modality
end

#provider_nameObject

Returns the value of attribute provider_name

Returns:

  • (Object)

    the current value of provider_name



106
107
108
# File 'lib/parse/model/core/embed_managed.rb', line 106

def provider_name
  @provider_name
end

#sourcesObject

Returns the value of attribute sources

Returns:

  • (Object)

    the current value of sources



106
107
108
# File 'lib/parse/model/core/embed_managed.rb', line 106

def sources
  @sources
end

Instance Method Details

#freezeObject



111
112
113
114
# File 'lib/parse/model/core/embed_managed.rb', line 111

def freeze
  sources.freeze
  super
end

#image?Boolean

Returns:

  • (Boolean)


116
117
118
# File 'lib/parse/model/core/embed_managed.rb', line 116

def image?
  modality == :image
end