No commit activity in last 3 years
No release in over 3 years
Wraps the protobuf FileDescriptorSet messages with happy features like type name resolution and the like.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.9.12.6
~> 10.3
~> 3.0.0.beta2
~> 1.1
~> 0.8

Runtime

>= 3.0.0, ~> 3.0
 Project Readme

protobuf_descriptor

Gem Version Build Status MIT license

Description

Protobuf_descriptor provides helper methods to make working with Google Protocol Buffer descriptors easier, go figure.. It handles type resolution, and computing type names (both within protocol buffers and in the generated output).

Examples

Given the descriptor.desc generated by the protocol buffer compiler, you can introspect the various data types. This example references the descriptor that would be generated by compiling single_file.proto

require 'protobuf_descriptor'
descriptor = ProtobufDescriptor.load("descriptor.desc")

# Load a single file by its filename/basename
file_descriptor = descriptor[:single_file]

# Grab a handle to an enum, or a message
file_descriptor.messages[:FieldOptions]
file_descriptor.enums[:UnnestedEnum]

# Also allows resolving types by their fully qualified name:
descriptor.resolve_type(".porkbuns.UnnestedEnum") # note the leading "."
# or even doing so relative to another enum
descriptor.resolve_type("CType", ".porkbuns.FieldOptions")

For even more gory details, please peruse the actual documentation.

Requirements

I've only tested this on Ruby 1.9.3+. If it works for you on an older version of Ruby, let me know. You most likely want to install the Google Protocol Buffer library.

Install

$ gem install protobuf_descriptor

Copyright

Copyright (c) 2014 Hsiu-Fan Wang

See LICENSE.txt for details.