Sha256: 083106971388905ea5ee025fcc45287b5fa3f19e5226e52d7c46b397617e9837

Contents?: true

Size: 563 Bytes

Versions: 19

Compression:

Stored size: 563 Bytes

Contents

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

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

      def call(proto)
        callable.call(proto)
      end

      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

19 entries across 19 versions & 1 rubygems

Version Path
protobuf-activerecord-3.6.0 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.5.1 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.5.0 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.4.4 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.4.4.pre lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.4.3 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.4.2 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.4.1 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.4.0 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.3.8 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.3.7 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.3.6 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.3.5 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.3.4 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.3.3 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.3.2 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.3.1 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.3.0 lib/protobuf/active_record/transformer.rb
protobuf-activerecord-3.2.2 lib/protobuf/active_record/transformer.rb