Sha256: 07c229f0cdd6de4b2d323b7bbb6137eecdcd8ede747ef0d7ad1b708ed164ed42

Contents?: true

Size: 1.7 KB

Versions: 1

Compression:

Stored size: 1.7 KB

Contents

= protobuf_descriptor

* {Homepage}[https://rubygems.org/gems/protobuf_descriptor]
* {Documentation}[http://rubydoc.info/gems/protobuf_descriptor/frames]

== 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}[https://github.com/hfwang/protobuf_descriptor/blob/master/spec/protos/single_file_test/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}[link:ProtobufDescriptor.html].

== 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}[https://code.google.com/p/protobuf/].

== Install

  $ gem install protobuf_descriptor

== Copyright

Copyright (c) 2014 Hsiu-Fan Wang

See LICENSE.txt for details.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
protobuf_descriptor-0.1.0 README.rdoc