We could avoid (re-)loading the secret each for each data bag item by doing the variable assignement below `secret_path`. Conversely, there is no need for the `secret_path` local var, is there?:
```ruby
  secret  = Chef::Config[:encrypted_data_bag_secret] ? Chef::EncryptedDataBagItem.load_secret(secret_path) : nil
  _result = []
  data_bag(bag_name.to_s).each do |bag_item_id|
    if secret
```