<commit_before>= 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].
<commit_msg>Point readme in the right place<commit_after>= protobuf_descriptor

* {Homepage}[https://rubygems.org/gems/protobuf_descriptor]
* {Documentation}[http://rubydoc.info/github/hfwang/protobuf_descriptor/master/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}[http://rubydoc.info/github/hfwang/protobuf_descriptor/master/frames].

{'fraction_non_alphanumeric': 0.08422138191818494, 'fraction_numerical': 0.0, 'mean_word_length': 5.689655172413793, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1813675', 'n_tokens_mistral': 784, 'n_tokens_neox': 755, 'n_words': 251}