Class: Fityk::Engine
- Inherits:
-
Object
- Object
- Fityk::Engine
- Defined in:
- lib/fityk/engine.rb
Overview
The Engine class encapsulates a single connection to a Fityk instance. Usage:
require 'fityk'
fityk = Fityk::Engine.new
fityk.get_info("version", true).split("\n")
fityk.load_data 0, [1,2,3], [4,5,6], [7,8,9]
fityk.get_data.entries.first
fityk.get_data.entries.first.x
fityk.get_data.entries.first.y
fityk.get_data.entries.first.sigma
Values are sent to and from Fityk by calling a method on the engine with the method name of interest.
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
A reference to the underlying Fityk driver used by this engine.
-
#handle ⇒ Object
readonly
The low-level opaque engine handle that this object wraps.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Engine
constructor
Create a new Engine object that connects to Fityk via the given driver.
-
#method_missing(method_id, *args) ⇒ Object
Call Fityk passing in the arguments.
Constructor Details
#initialize(options = {}) ⇒ Engine
Create a new Engine object that connects to Fityk via the given driver
27 28 29 30 31 |
# File 'lib/fityk/engine.rb', line 27 def initialize( = {}) load_driver([:driver]) @handle = @driver.open() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *args) ⇒ Object
Call Fityk passing in the arguments
34 35 36 |
# File 'lib/fityk/engine.rb', line 34 def method_missing(method_id, *args) @driver.call(@handle, method_id, *args) end |
Instance Attribute Details
#driver ⇒ Object (readonly)
A reference to the underlying Fityk driver used by this engine.
24 25 26 |
# File 'lib/fityk/engine.rb', line 24 def driver @driver end |
#handle ⇒ Object (readonly)
The low-level opaque engine handle that this object wraps.
21 22 23 |
# File 'lib/fityk/engine.rb', line 21 def handle @handle end |