Skip to content

Commit bfdb813

Browse files
committed
Simplify conditional in static loader
Prior to this commit the static loader class used variable assignment in conditionals unnecessarily and made a comparison (name_authority == Pcore::RUNTIME_NAME_AUTHORITY) that was always true. This commit simplifies the conditionals to both remove the redundant comparison and variable assignment in conditional.
1 parent fce49ba commit bfdb813

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/puppet/pops/loader/static_loader.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ def initialize
4646

4747
def discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_AUTHORITY)
4848
# Static loader only contains runtime types
49-
return EMPTY_ARRAY unless type == :type && name_authority == name_authority = Pcore::RUNTIME_NAME_AUTHORITY
49+
return EMPTY_ARRAY unless type == :type && name_authority == Pcore::RUNTIME_NAME_AUTHORITY
5050

51-
typed_names = type == :type && name_authority == Pcore::RUNTIME_NAME_AUTHORITY ? @loaded.keys : EMPTY_ARRAY
51+
typed_names = @loaded.keys
5252
block_given? ? typed_names.select { |tn| yield(tn) } : typed_names
5353
end
5454

0 commit comments

Comments
 (0)