Class: Threatinator::CLI::ActionBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/threatinator/cli/action_builder.rb

Direct Known Subclasses

ListActionBuilder, RunActionBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_hash, extra_args) ⇒ ActionBuilder

Returns a new instance of ActionBuilder.



9
10
11
12
13
# File 'lib/threatinator/cli/action_builder.rb', line 9

def initialize(config_hash, extra_args)
  @extra_args = extra_args
  @config_hash = config_hash
  @feed_registry = nil
end

Instance Attribute Details

#config_hashObject (readonly)

Returns the value of attribute config_hash.



7
8
9
# File 'lib/threatinator/cli/action_builder.rb', line 7

def config_hash
  @config_hash
end

#extra_argsObject (readonly)

Returns the value of attribute extra_args.



7
8
9
# File 'lib/threatinator/cli/action_builder.rb', line 7

def extra_args
  @extra_args
end

Instance Method Details

#buildObject

Raises:

  • (NotImplementedError)


15
16
17
18
19
# File 'lib/threatinator/cli/action_builder.rb', line 15

def build
  #:nocov:
  raise NotImplementedError.new("#{self.class}#build not implemented")
  #:nocov:
end

#feed_registryObject



21
22
23
24
25
26
27
28
# File 'lib/threatinator/cli/action_builder.rb', line 21

def feed_registry
  return @feed_registry unless @feed_registry.nil?

  feed_search_hash = config_hash["feed_search"] || {}
  feed_search_config = Threatinator::Config::FeedSearch.new(feed_search_hash)

  @feed_registry = Threatinator::FeedRegistry.build(feed_search_config)
end