class Protobuf::ActiveRecord::Transformer

Attributes

callable[RW]
options[RW]

Public Class Methods

new(callable, options = {}) click to toggle source
# File lib/protobuf/active_record/transformer.rb, line 6
def initialize(callable, options = {})
  @callable = callable
  @options = options
end

Public Instance Methods

nullify?(proto) click to toggle source
# File lib/protobuf/active_record/transformer.rb, line 13
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