class Protobuf::Generators::Base
Attributes
descriptor[R]
namespace[R]
options[R]
Public Class Methods
new(descriptor, indent_level = 0, options = {})
click to toggle source
# File lib/protobuf/generators/base.rb, line 34 def initialize(descriptor, indent_level = 0, options = {}) @descriptor = descriptor @options = options @namespace = @options.fetch(:namespace) { [] } init_printer(indent_level) end
Public Instance Methods
fully_qualified_type_namespace()
click to toggle source
# File lib/protobuf/generators/base.rb, line 41 def fully_qualified_type_namespace ".#{type_namespace.join('.')}" end
run_once(label, &block)
click to toggle source
# File lib/protobuf/generators/base.rb, line 45 def run_once(label, &block) tracker_ivar = "@_#{label}_compiled" value_ivar = "@_#{label}_compiled_value" if instance_variable_get(tracker_ivar) return instance_variable_get(value_ivar) else return_value = block.call instance_variable_set(tracker_ivar, true) instance_variable_set(value_ivar, return_value) return return_value end end
to_s()
click to toggle source
# File lib/protobuf/generators/base.rb, line 59 def to_s compile print_contents # see Printable end
type_namespace()
click to toggle source
# File lib/protobuf/generators/base.rb, line 64 def type_namespace @type_namespace ||= @namespace + [descriptor.name] end