Class: BlogSchemaExtractor
- Inherits:
-
BaseService
- Object
- BaseService
- BlogSchemaExtractor
- Defined in:
- app/services/blog_schema_extractor.rb
Instance Attribute Summary collapse
-
#article ⇒ Object
readonly
Returns the value of attribute article.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(article, options = {}) ⇒ BlogSchemaExtractor
constructor
A new instance of BlogSchemaExtractor.
- #process ⇒ Object
Methods inherited from BaseService
#log_debug, #log_warning, #logger, #options, #tagged_logger
Constructor Details
#initialize(article, options = {}) ⇒ BlogSchemaExtractor
Returns a new instance of BlogSchemaExtractor.
4 5 6 7 8 |
# File 'app/services/blog_schema_extractor.rb', line 4 def initialize(article, = {}) @article = article @model = [:model].presence || AiModelConstants.id(:blog_extraction) super() end |
Instance Attribute Details
#article ⇒ Object (readonly)
Returns the value of attribute article.
2 3 4 |
# File 'app/services/blog_schema_extractor.rb', line 2 def article @article end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
2 3 4 |
# File 'app/services/blog_schema_extractor.rb', line 2 def model @model end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
2 3 4 |
# File 'app/services/blog_schema_extractor.rb', line 2 def result @result end |
Instance Method Details
#process ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/blog_schema_extractor.rb', line 10 def process log_info "Processing schema extraction for article #{article.id}: #{article.subject}" @result = extract_schema_content save_schema_markup if @result[:schemas].present? # Always update the timestamp to mark that extraction was attempted # This prevents the same articles from being processed repeatedly @result end |