Module: ArProtobufStore

Defined in:
lib/ar_protobuf_store.rb,
lib/ar_protobuf_store/railtie.rb,
lib/ar_protobuf_store/version.rb,
lib/ar_protobuf_store/protobuf_parser.rb,
lib/ar_protobuf_store/codekitchen_protobuf_parser.rb

Defined Under Namespace

Modules: ClassMethods Classes: CodekitchenProtobufParser, ProtobufParser, Railtie

Constant Summary collapse

VERSION =

ar_protobuf_store version

"1.0.2"

Class Method Summary collapse

Class Method Details

.find_parser!(pb_class, options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/ar_protobuf_store.rb', line 15

def self.find_parser!(pb_class, options={})
  if defined?(ProtocolBuffers) && ::ProtocolBuffers::Message > pb_class
    return ArProtobufStore::CodekitchenProtobufParser.new(pb_class, options)
  elsif defined?(Protobuf) && ::Protobuf::Message > pb_class
    return ArProtobufStore::ProtobufParser.new(pb_class, options)
  else
    raise "Could not identify protocol buffer library for #{pb_class}"
  end
end

.included(base) ⇒ Object



11
12
13
# File 'lib/ar_protobuf_store.rb', line 11

def self.included(base)
  base.extend(ClassMethods)
end