Skip to content

Commit e2940ae

Browse files
committed
♻️ Renamed as_array to to_a
.. which is more common.
1 parent 2f29662 commit e2940ae

27 files changed

+57
-57
lines changed

lib/netbox_client_ruby/entities.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def [](index)
120120
as_entity raw_data_array[index]
121121
end
122122

123-
def as_array
123+
def to_a
124124
raw_data_array.map { |raw_entity| as_entity raw_entity }
125125
end
126126

spec/netbox_client_ruby/api/dcim/device_roles_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545

4646
describe '#as_array' do
4747
it 'return the correct amount' do
48-
expect(subject.as_array.length).to be expected_length
48+
expect(subject.to_a.length).to be expected_length
4949
end
5050

5151
it 'returns Site instances' do
52-
subject.as_array.each do |element|
52+
subject.to_a.each do |element|
5353
expect(element).to be_a singular_type
5454
end
5555
end

spec/netbox_client_ruby/api/dcim/device_types_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545

4646
describe '#as_array' do
4747
it 'return the correct amount' do
48-
expect(subject.as_array.length).to be expected_length
48+
expect(subject.to_a.length).to be expected_length
4949
end
5050

5151
it 'returns Site instances' do
52-
subject.as_array.each do |element|
52+
subject.to_a.each do |element|
5353
expect(element).to be_a singular_type
5454
end
5555
end

spec/netbox_client_ruby/api/dcim/devices_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545

4646
describe '#as_array' do
4747
it 'return the correct amount' do
48-
expect(subject.as_array.length).to be expected_length
48+
expect(subject.to_a.length).to be expected_length
4949
end
5050

5151
it 'returns Site instances' do
52-
subject.as_array.each do |element|
52+
subject.to_a.each do |element|
5353
expect(element).to be_a singular_type
5454
end
5555
end

spec/netbox_client_ruby/api/dcim/interfaces_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545

4646
describe '#as_array' do
4747
it 'return the correct amount' do
48-
expect(subject.as_array.length).to be expected_length
48+
expect(subject.to_a.length).to be expected_length
4949
end
5050

5151
it 'returns Site instances' do
52-
subject.as_array.each do |element|
52+
subject.to_a.each do |element|
5353
expect(element).to be_a singular_type
5454
end
5555
end

spec/netbox_client_ruby/api/dcim/inventory_items_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545

4646
describe '#as_array' do
4747
it 'return the correct amount' do
48-
expect(subject.as_array.length).to be expected_length
48+
expect(subject.to_a.length).to be expected_length
4949
end
5050

5151
it 'returns Site instances' do
52-
subject.as_array.each do |element|
52+
subject.to_a.each do |element|
5353
expect(element).to be_a singular_type
5454
end
5555
end

spec/netbox_client_ruby/api/dcim/manufacturers_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242

4343
describe '#as_array' do
4444
it 'return the correct amount' do
45-
expect(subject.as_array.length).to be 2
45+
expect(subject.to_a.length).to be 2
4646
end
4747

4848
it 'returns Site instances' do
49-
subject.as_array.each do |element|
49+
subject.to_a.each do |element|
5050
expect(element).to be_a NetboxClientRuby::DCIM::Region
5151
end
5252
end

spec/netbox_client_ruby/api/dcim/platforms_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545

4646
describe '#as_array' do
4747
it 'return the correct amount' do
48-
expect(subject.as_array.length).to be expected_length
48+
expect(subject.to_a.length).to be expected_length
4949
end
5050

5151
it 'returns Site instances' do
52-
subject.as_array.each do |element|
52+
subject.to_a.each do |element|
5353
expect(element).to be_a singular_type
5454
end
5555
end

spec/netbox_client_ruby/api/dcim/power_outlets_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545

4646
describe '#as_array' do
4747
it 'return the correct amount' do
48-
expect(subject.as_array.length).to be expected_length
48+
expect(subject.to_a.length).to be expected_length
4949
end
5050

5151
it 'returns Site instances' do
52-
subject.as_array.each do |element|
52+
subject.to_a.each do |element|
5353
expect(element).to be_a singular_type
5454
end
5555
end

spec/netbox_client_ruby/api/dcim/power_ports_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545

4646
describe '#as_array' do
4747
it 'return the correct amount' do
48-
expect(subject.as_array.length).to be expected_length
48+
expect(subject.to_a.length).to be expected_length
4949
end
5050

5151
it 'returns Site instances' do
52-
subject.as_array.each do |element|
52+
subject.to_a.each do |element|
5353
expect(element).to be_a singular_type
5454
end
5555
end

0 commit comments

Comments
 (0)