Class: Fisk::Helpers::JITBuffer
- Inherits:
-
Object
- Object
- Fisk::Helpers::JITBuffer
- Defined in:
- lib/fisk/helpers.rb
Instance Attribute Summary collapse
-
#memory ⇒ Object
readonly
Returns the value of attribute memory.
-
#pos ⇒ Object
readonly
Returns the value of attribute pos.
Instance Method Summary collapse
-
#initialize(memory) ⇒ JITBuffer
constructor
A new instance of JITBuffer.
- #putc(byte) ⇒ Object
- #to_function(params, ret) ⇒ Object
Constructor Details
#initialize(memory) ⇒ JITBuffer
Returns a new instance of JITBuffer.
54 55 56 57 |
# File 'lib/fisk/helpers.rb', line 54 def initialize memory @memory = memory @pos = 0 end |
Instance Attribute Details
#memory ⇒ Object (readonly)
Returns the value of attribute memory.
52 53 54 |
# File 'lib/fisk/helpers.rb', line 52 def memory @memory end |
#pos ⇒ Object (readonly)
Returns the value of attribute pos.
52 53 54 |
# File 'lib/fisk/helpers.rb', line 52 def pos @pos end |
Instance Method Details
#putc(byte) ⇒ Object
59 60 61 62 |
# File 'lib/fisk/helpers.rb', line 59 def putc byte @memory[@pos] = byte @pos += 1 end |
#to_function(params, ret) ⇒ Object
64 65 66 |
# File 'lib/fisk/helpers.rb', line 64 def to_function params, ret Fiddle::Function.new memory.to_i, params, ret end |