Class: Firecrawl::ScrapeOptions
- Inherits:
-
Object
- Object
- Firecrawl::ScrapeOptions
- Includes:
- DynamicSchema::Definable, Helpers
- Defined in:
- lib/firecrawl/scrape_options.rb
Constant Summary collapse
- FORMATS =
[ :summary, :markdown, :html, :raw_html, :links, :screenshot ]
- ACTIONS =
[ :wait, :click, :write, :press, :screenshot, :scrape ]
Class Method Summary collapse
- .build(options = nil, &block) ⇒ Object
- .build!(options = nil, &block) ⇒ Object
- .normalize_options(options) ⇒ Object
Instance Method Summary collapse
-
#initialize(options = {}, api_options: nil) ⇒ ScrapeOptions
constructor
A new instance of ScrapeOptions.
- #to_h ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(options = {}, api_options: nil) ⇒ ScrapeOptions
Returns a new instance of ScrapeOptions.
78 79 80 81 |
# File 'lib/firecrawl/scrape_options.rb', line 78 def initialize( = {}, api_options: nil ) @options = self.class.builder.build( || {} ) @options = .merge( @options ) if end |
Class Method Details
.build(options = nil, &block) ⇒ Object
58 59 60 |
# File 'lib/firecrawl/scrape_options.rb', line 58 def self.build( = nil, &block ) new( api_options: builder.build( , &block ) ) end |
.build!(options = nil, &block) ⇒ Object
62 63 64 |
# File 'lib/firecrawl/scrape_options.rb', line 62 def self.build!( = nil, &block ) new( api_options: builder.build!( , &block ) ) end |
.normalize_options(options) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/firecrawl/scrape_options.rb', line 66 def self.( ) = &.dup || {} screenshot = .delete( :screenshot ) if screenshot formats = [ :formats ] || [] formats.delete( :screenshot ) formats << screenshot [ :formats ] = formats end end |
Instance Method Details
#to_h ⇒ Object
83 84 85 |
# File 'lib/firecrawl/scrape_options.rb', line 83 def to_h @options.to_h end |