README.md in yara-ffi-2.1.1 vs README.md in yara-ffi-3.0.0
- old
+ new
@@ -18,10 +18,37 @@
$ gem install yara-ffi
## Usage
-TODO: Write usage instructions here
+```ruby
+Yara.start # run before you start using the Yara API.
+
+rule = <<-RULE
+rule ExampleRule
+{
+meta:
+ string_meta = "an example rule for testing"
+
+strings:
+ $my_text_string = "we were here"
+ $my_text_regex = /were here/
+
+condition:
+ $my_text_string or $my_text_regex
+}
+RULE
+
+scanner = Yara::Scanner.new
+scanner.add_rule(rule)
+scanner.compile
+result = scanner.call("one day we were here and then we were not")
+result.match?
+# => true
+
+scanner.close # run when you are done using the scanner API and want to free up memory.
+Yara.stop # run when you are completely done using the Yara API to free up memory.
+```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.