mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-16 03:41:41 +00:00
Look into options['extract'] for checking the extraction type.
WebsiteAgent#extraction_type was private and uncallable, and may not remain existent in future.
This commit is contained in:
parent
fa0723ed8a
commit
70157dc687
1 changed files with 9 additions and 1 deletions
|
@ -1,7 +1,15 @@
|
|||
class AdoptXpathInWebsiteAgent < ActiveRecord::Migration
|
||||
class Agent < ActiveRecord::Base
|
||||
include JSONSerializedField
|
||||
json_serialize :options
|
||||
end
|
||||
|
||||
def up
|
||||
Agent.where(type: 'Agents::WebsiteAgent').each do |agent|
|
||||
next if agent.extraction_type == 'json'
|
||||
extract = agent.options['extract']
|
||||
next unless extract.is_a?(Hash) && extract.all? { |name, detail|
|
||||
detail.key?('xpath') || detail.key?('css')
|
||||
}
|
||||
|
||||
agent.options_will_change!
|
||||
agent.options['extract'].each { |name, extraction|
|
||||
|
|
Loading…
Add table
Reference in a new issue