We also had a hard time following this in code review. It's weird that we initialize `@metadata` to a Hash and then have to check its type here. This whole process might become easier to understand if you switch to making this class lazy load cookbook data from disk as needed. For example:
```ruby
def metadata
  @metadata ||= load_metadata
end
```
Then you could modify the `cookbook_name` method from my above example to be
```ruby
def cookbook_name
  metadata.name || @cookbook_pathname
end
```
And it will be very clear where the data is coming from.