Class: E621ExportDownloader::Client::Options::Builder

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/e621_export_downloader/client/options/builder.rb,
lib/e621_export_downloader/client/options/builder/parsers.rb

Defined Under Namespace

Classes: Parsers

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(defaults = Options.new) ⇒ Builder

Returns a new instance of Builder.



17
18
19
20
# File 'lib/e621_export_downloader/client/options/builder.rb', line 17

def initialize(defaults = Options.new)
  @cache = T.let(defaults.cache, T::Boolean)
  @parsers = T.let(defaults.parsers, Options::Parsers)
end

Instance Attribute Details

#cacheObject

Returns the value of attribute cache.



11
12
13
# File 'lib/e621_export_downloader/client/options/builder.rb', line 11

def cache
  @cache
end

#parsers(&block) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/e621_export_downloader/client/options/builder.rb', line 23

def parsers(&block)
  return @parsers if block.nil?
  parsers = Builder::Parsers.new(@parsers)
  block.call(parsers)

  @parsers = Options::Parsers.new(
    artists:              parsers.artists,
    bulk_update_requests: parsers.bulk_update_requests,
    pools:                parsers.pools,
    posts:                parsers.posts,
    post_replacements:    parsers.post_replacements,
    post_versions:        parsers.post_versions,
    tag_aliases:          parsers.tag_aliases,
    tag_implications:     parsers.tag_implications,
    tags:                 parsers.tags,
    wiki_pages:           parsers.wiki_pages,
  )
end