Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-526

Generated Ruby enums have no good way to get the names back out once you have a number.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.2
    • Ruby - Compiler
    • None
    • Patch Available

    Description

      Thrift enums are compiled into Ruby modules as Ruby has no native enum type. This works well except that without maintaining a separate map somewhere else or using reflection, it is impossible to get the names of the values back out from the values themselves. Essentially with this setup:

      module MyModule
      DATAPOINT = 1
      OTHERDATA = 2
      end

      If I have 2, it is very difficult to get "OTHERDATA" back out. It would be easier if thrift generated a static map from constant value to constant name. I am going to try and work on a patch for this.

      Attachments

        1. thrift-526.patch
          2 kB
          Adam Coffman

        Activity

          People

            thecoffman Adam Coffman
            thecoffman Adam Coffman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: