Skip to content

Commit

Permalink
Renamed Config::Workers#as_yaml to #to_h.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Sep 1, 2024
1 parent e0f8543 commit d862526
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/ronin/recon/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def eql?(other)
#
# @since 0.2.0
#
def as_yaml
def to_h
hash = {}

# enable the workers in the set.
Expand Down Expand Up @@ -405,7 +405,7 @@ def to_yaml(options={})

data[:params] = @params unless @params.empty?
data[:concurrency] = @concurrency unless @concurrency.empty?
data[:workers] = @workers.as_yaml if @workers
data[:workers] = @workers.to_h if @workers

data.to_yaml(options)
end
Expand Down
10 changes: 5 additions & 5 deletions spec/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@
end
end

describe "#as_yaml" do
describe "#to_h" do
context "when initialized the default set of workers" do
subject { described_class.default }

it "must return an empty Hash" do
expect(subject.as_yaml).to eq({})
expect(subject.to_h).to eq({})
end
end

Expand All @@ -184,7 +184,7 @@
subject { described_class.new(set) }

it "must return a Hash with the worker IDs from the default, that are not in the array, disabled and the worker IDs that are not in the default set, but in the array, enabled" do
expect(subject.as_yaml).to eq(
expect(subject.to_h).to eq(
{
'dns/mailservers' => false,
'dns/nameservers' => false,
Expand All @@ -211,7 +211,7 @@
subject { described_class.new(array) }

it "must return a Hash with the worker IDs from the default, that are not in the array, disabled and the worker IDs that are not in the default set, but in the array, enabled" do
expect(subject.as_yaml).to eq(
expect(subject.to_h).to eq(
{
'dns/mailservers' => false,
'dns/nameservers' => false,
Expand Down Expand Up @@ -245,7 +245,7 @@
subject { described_class.new(hash) }

it "must return a Hash with the worker IDs that are disabled and enabled, which are not already in the default set" do
expect(subject.as_yaml).to eq(
expect(subject.to_h).to eq(
{
'net/port_scan' => false,
'web/new_worker' => true
Expand Down

0 comments on commit d862526

Please sign in to comment.