Module: Prototok::Utils::Protoc
- Defined in:
- lib/prototok/utils/protoc.rb
Class Method Summary collapse
Class Method Details
.cache ⇒ Object
8 9 10 |
# File 'lib/prototok/utils/protoc.rb', line 8 def cache @cache ||= Set.new end |
.process(path) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/prototok/utils/protoc.rb', line 12 def process(path) path = File. path if !path || !File.exist?(path) raise ArgumentError, 'protobuf proto file is missing' end input = File.read(path) digest = Digest::SHA256.hexdigest(input) if cache.include? digest false else temp = ::Tempfile.new digest temp.write input temp.rewind load_proto temp, digest end end |