You could refactor as follows:

```
def match_item_proc(params)
  raise NotImplementedError, params.inspect if params.size > 4
  return proc { true } if params.empty?
  parts = params.to_a.map { |part| match_item_proc_part(part) }
  raise NotImplementedError, params.inspect unless parts.all? { |part| !!part }
  proc { |id, item| parts.all? { |part| part.call(id, item) } }
end
```