Sha256: 6dcdffca7ad24886931719f2a0f378c7c9f62c09ec5efc2d7802efe331588a0e

Contents?: true

Size: 538 Bytes

Versions: 1

Compression:

Stored size: 538 Bytes

Contents

module Protobuf
  module ActiveRecord
    class Transformer
      attr_accessor :callable, :options

      def initialize(callable, options = {})
        @callable = callable
        @options = options
      end

      delegate :call, to: :callable

      def nullify?(proto)
        return false unless options[:nullify_on]
        return false unless proto.field?(:nullify) && proto.nullify.is_a?(Array)
        return false if proto.nullify.empty?

        proto.nullify.include?(options[:nullify_on].to_s)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
protobuf-activerecord-7.0.0 lib/protobuf/active_record/transformer.rb