Skip to content

Commit bdc0d3b

Browse files
akofinkxprazak2
authored andcommitted
Improve usage in the readme with examples
Signed-off-by: Andrew Kofink <akofink@redhat.com>
1 parent 429a381 commit bdc0d3b

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/openscap_parser`. To experiment with that code, run `bin/console` for an interactive prompt.
44

5-
TODO: Delete this and the text above, and describe your gem
6-
75
## Installation
86

97
Add this line to your application's Gemfile:
@@ -24,15 +22,18 @@ Or install it yourself as:
2422

2523
ARF/XCCDF report goes IN - Ruby hash goes OUT
2624

27-
{
28-
profile
29-
host
30-
score
31-
start_time
32-
end_time
33-
rule_result
34-
35-
}
25+
```rb
26+
parser = OpenscapParser::Base.new(File.read('rhel7-xccdf_org.ssgproject.content_profile_standard.xml'))
27+
parser.host # "rhel7-insights-client.virbr0.akofink-laptop"
28+
parser.start_time # <DateTime: 2019-08-08T17:25:50+00:00 ((2458704j,62750s,0n),+0s,2299161j)>
29+
parser.end_time # <DateTime: 2019-08-08T17:26:45+00:00 ((2458704j,62805s,0n),+0s,2299161j)>
30+
parser.score # 80.833328
31+
parser.profiles # {"xccdf_org.ssgproject.content_profile_standard"=>"Standard System Security Profile for Red Hat Enterprise Linux 7"}
32+
parser.rules # [#<OpenscapParser::Rule:0x00005576e752db7 ... >, ...]
33+
parser.rule_results # [#<OpenscapParser::RuleResult:0x00005576e8022f60 @id="xccdf_org.ssgproject.content_rule_package_rsh_removed", @result="notselected">, ...]
34+
35+
# and more!
36+
```
3637

3738

3839
## Development

lib/openscap_parser/rules.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def rule_objects
1616
Rule.new(rule_xml: rule)
1717
end
1818
end
19+
alias :rules :rule_objects
1920
end
2021
end
2122
end

0 commit comments

Comments
 (0)