The only thing that varies here is the name of the method and only the bits affix in the method, so it's cleaner to just make this a lookup table and send:

```ruby
# Declare constant at the class level, so around [line 19](https://github.com/Meatballs1/metasploit-framework/blob/9786f84a6ebe054f7aca50a26748885ee80a809a/lib/msf/util/exe.rb#L19)
PE_SERVICE_BITS_BY_ARCH = {
  nil => 32,
  ARCH_X86 => 32,
  ARCH_X86_64 => 64,
  ARCH_X64 => 64
}

# ... then replace this when
  bits = PE_SERVICE_BITS_BY_ARCH[arch]
  # now the common bits of the method name don't have to be repeated
  method = "to_win#{bits}pe_service"
  # now the arguments don't have to be repeated
  output = send(method, framework, code, exeopts)
```