When looking at this in code review, it's hard to see if the code will do the right thing because of how you're mutating the `@cookbook_name` variable. This would be easier to understand if broken into methods that clearly show the logic.

In this case, it would be preferable to remove direct access to the `@cookbook_name` instance variable and make that go through a method. For example:

```ruby
def cookbook_name
  @cookbook_name || @cookbook_pathname
end
```
makes it much easier to tell that you want to use `@cookbook_name` but will fallback to `@cookbook_pathname`