Class: Torchrb::Lua
- Inherits:
-
Object
- Object
- Torchrb::Lua
- Defined in:
- lib/torchrb/lua.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#enable_cuda ⇒ Object
Returns the value of attribute enable_cuda.
Instance Method Summary collapse
- #eval(command, file = __FILE__, line = __LINE__, debug: false) ⇒ Object
-
#initialize(options = {}) ⇒ Lua
constructor
A new instance of Lua.
Constructor Details
#initialize(options = {}) ⇒ Lua
Returns a new instance of Lua.
6 7 8 9 10 |
# File 'lib/torchrb/lua.rb', line 6 def initialize ={} self.enable_cuda = .delete(:enable_cuda) { false } self.debug = .delete(:debug) { false } @additional_libraries = .delete(:lua_libs){[]} end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
4 5 6 |
# File 'lib/torchrb/lua.rb', line 4 def debug @debug end |
#enable_cuda ⇒ Object
Returns the value of attribute enable_cuda.
3 4 5 |
# File 'lib/torchrb/lua.rb', line 3 def enable_cuda @enable_cuda end |
Instance Method Details
#eval(command, file = __FILE__, line = __LINE__, debug: false) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/torchrb/lua.rb', line 13 def eval(command, file=__FILE__, line=__LINE__, debug: false) load_libraries unless @libraries_loaded @last_command = command puts command if debug || @debug state.eval command, nil, file, line end |