Skip to content

Commit

Permalink
Switch Pbbuilder to BasicObject
Browse files Browse the repository at this point in the history
  • Loading branch information
julik committed Sep 4, 2024
1 parent 52f2c6f commit 2c7ffab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
10 changes: 8 additions & 2 deletions lib/pbbuilder.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require "pbbuilder/pbbuilder"
require 'pbbuilder/errors'
require "pbbuilder/protobuf_extension"
require "pbbuilder/railtie" if defined?(Rails)
Expand Down Expand Up @@ -29,7 +28,7 @@
# It basically works exactly like jbuilder. The main difference is that it can use introspection to figure out what kind
# of protobuf message it needs to create.

class Pbbuilder
class Pbbuilder < BasicObject
def initialize(message)
@message = message

Expand All @@ -48,6 +47,13 @@ def respond_to_missing?(field)
!!_descriptor_for_field(field)
end

# Make it possible to raise - this is the same functionality
# that ActiveSupport::BasicObject used to be adding to BasicObject,
# mostly for convenience
def raise(*args)
::Object.send(:raise, *args)
end

def set!(field, *args, &block)
name = field.to_s
descriptor = _descriptor_for_field(name)
Expand Down
9 changes: 0 additions & 9 deletions lib/pbbuilder/pbbuilder.rb

This file was deleted.

0 comments on commit 2c7ffab

Please sign in to comment.