Class: Tidybuf
- Inherits:
-
Object
- Object
- Tidybuf
- Extended by:
- DL::Importable
- Defined in:
- lib/tidy/tidybuf.rb
Overview
Buffer structure.
Instance Attribute Summary collapse
-
#struct ⇒ Object
readonly
Access TidyBuffer instance.
Instance Method Summary collapse
-
#free ⇒ Object
Free current contents and zero out.
-
#initialize ⇒ Tidybuf
constructor
A new instance of Tidybuf.
-
#to_a ⇒ Object
Convert to array.
-
#to_s ⇒ Object
Convert to string.
Constructor Details
#initialize ⇒ Tidybuf
Returns a new instance of Tidybuf.
11 12 13 |
# File 'lib/tidy/tidybuf.rb', line 11 def initialize @struct = self.class.struct(construct_tidy_buffer).malloc end |
Instance Attribute Details
#struct ⇒ Object (readonly)
Access TidyBuffer instance.
9 10 11 |
# File 'lib/tidy/tidybuf.rb', line 9 def struct @struct end |
Instance Method Details
#free ⇒ Object
Free current contents and zero out.
17 18 19 |
# File 'lib/tidy/tidybuf.rb', line 17 def free Tidylib.buf_free(@struct) end |
#to_a ⇒ Object
Convert to array.
23 24 25 |
# File 'lib/tidy/tidybuf.rb', line 23 def to_a to_s.split($/) end |
#to_s ⇒ Object
Convert to string.
29 30 31 |
# File 'lib/tidy/tidybuf.rb', line 29 def to_s @struct.bp ? @struct.bp.to_s(@struct.size) : '' end |