Class: OpenSCAP::Text
- Inherits:
-
Object
- Object
- OpenSCAP::Text
- Defined in:
- lib/openscap/text.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(t = nil) ⇒ Text
constructor
A new instance of Text.
- #text ⇒ Object
- #text=(str) ⇒ Object
Constructor Details
#initialize(t = nil) ⇒ Text
Returns a new instance of Text.
7 8 9 10 11 12 13 14 |
# File 'lib/openscap/text.rb', line 7 def initialize(t = nil) @raw = case t when FFI::Pointer t when nil OpenSCAP.oscap_text_new end end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
5 6 7 |
# File 'lib/openscap/text.rb', line 5 def raw @raw end |
Instance Method Details
#destroy ⇒ Object
24 25 26 27 |
# File 'lib/openscap/text.rb', line 24 def destroy OpenSCAP.oscap_text_free(raw) @raw = nil end |
#text ⇒ Object
20 21 22 |
# File 'lib/openscap/text.rb', line 20 def text OpenSCAP.oscap_text_get_text(@raw).force_encoding Encoding::UTF_8 end |
#text=(str) ⇒ Object
16 17 18 |
# File 'lib/openscap/text.rb', line 16 def text=(str) OpenSCAP.raise! unless OpenSCAP.oscap_text_set_text(raw, str) end |