Sha256: db27a0db204efaea64edaecd6c6d28452a413e1034698bf1d345d8cb39ac58df

Contents?: true

Size: 515 Bytes

Versions: 2

Compression:

Stored size: 515 Bytes

Contents

# frozen_string_literal: true

require "ffi"
require "pry"
require_relative "yara/ffi"
require_relative "yara/scan_result"
require_relative "yara/scanner"
require_relative "yara/version"

module Yara
  def self.start
    Yara::FFI.yr_initialize
  end

  def self.stop
    Yara::FFI.yr_finalize
  end

  def self.test(rule_string, test_string)
    start
    scanner = Yara::Scanner.new
    scanner.add_rule(rule_string)
    scanner.compile
    scanner.call(test_string)
  ensure
    scanner.close
    stop
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yara-ffi-3.1.0 lib/yara.rb
yara-ffi-3.0.0 lib/yara.rb