Sha256: dcceb5035d21f849a7720f7e34c62854166fc7d9f45c4a3c3defa5f8a39a500b

Contents?: true

Size: 304 Bytes

Versions: 1

Compression:

Stored size: 304 Bytes

Contents

require 'protobuf'

class Protobuf::Message
  def respond_to_and_has?(key)
    self.respond_to?(key) && self.has_field?(key)
  end

  def respond_to_and_has_and_present?(key)
    self.respond_to_and_has?(key) &&
      (self.__send__(key).present? || [true, false].include?(self.__send__(key)))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
protobuf-activerecord-1.1.0 lib/protobuf_ext/message.rb