Class: SpreeMenuChat::ContentBuilder
- Inherits:
-
Object
- Object
- SpreeMenuChat::ContentBuilder
- Defined in:
- app/services/spree_menu_chat/content_builder.rb
Overview
Builds the plain-text chunk that actually gets embedded for one source record. Kept separate from ReembedProductJob/ReembedCatalogJob so the "what text represents this record" question has one answer, checked once by SpreeMenuChat::Embedding#content_hash_for to decide whether a re-embed is even necessary.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(embeddable) ⇒ ContentBuilder
constructor
A new instance of ContentBuilder.
Constructor Details
#initialize(embeddable) ⇒ ContentBuilder
Returns a new instance of ContentBuilder.
12 13 14 |
# File 'app/services/spree_menu_chat/content_builder.rb', line 12 def initialize() @embeddable = end |
Class Method Details
.call(embeddable) ⇒ Object
8 9 10 |
# File 'app/services/spree_menu_chat/content_builder.rb', line 8 def self.call() new().call end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/services/spree_menu_chat/content_builder.rb', line 16 def call case @embeddable when Spree::Product product_content when Spree::Policy policy_content else raise ArgumentError, "SpreeMenuChat::ContentBuilder doesn't know how to embed a #{@embeddable.class}" end end |