Skip to content

Commit 42bb090

Browse files
committed
Fix errors
1 parent 42a5e50 commit 42bb090

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/optimizely/config/datafile_project_config.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ def initialize(datafile, logger, error_handler)
8383
# Utility maps for quick lookup
8484
@attribute_key_map = generate_key_map(@attributes, 'key')
8585
@attribute_id_to_key_map = {}
86-
for attribute in @attributes
86+
@attributes.each do |attribute|
8787
@attribute_id_to_key_map[attribute['id']] = attribute['key']
88-
end
88+
end
8989
@event_key_map = generate_key_map(@events, 'key')
9090
@group_id_map = generate_key_map(@groups, 'id')
9191
@group_id_map.each do |key, group|
@@ -453,9 +453,7 @@ def get_attribute_by_key(attribute_key)
453453
# Returns:
454454
# Attribute corresponding to the provided attribute key.
455455
attribute = @attribute_key_map[attribute_key]
456-
if @attribute_key_map.key?(attribute_key)
457-
return attribute
458-
end
456+
return attribute if @attribute_key_map.key?(attribute_key)
459457

460458
invalid_attribute_error = InvalidAttributeError.new(attribute_key)
461459
@logger.log Logger::ERROR, invalid_attribute_error.message
@@ -472,9 +470,7 @@ def get_attribute_key_by_id(attribute_id)
472470
# Returns:
473471
# Attribute key corresponding to the provided attribute ID.
474472
attribute = @attribute_id_to_key_map[attribute_id]
475-
if @attribute_id_to_key_map.key?(attribute_id)
476-
return attribute
477-
end
473+
return attribute if @attribute_id_to_key_map.key?(attribute_id)
478474

479475
invalid_attribute_error = InvalidAttributeError.new(attribute_id)
480476
@logger.log Logger::ERROR, invalid_attribute_error.message

0 commit comments

Comments
 (0)