Sha256: f9658eb5c4888957dd5390e7c0222259e82a15db005e6e4241b7f845f432cf2c
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
# ruby.rb: interaction with user-supplied Ruby code # copyright (c) 2014 by Vincent Fourmond # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details (in the COPYING file). module CTioga2 # The class in charge of the interaction with Ruby code class Ruby # Module where all instance methods declared become immediately # class methods. class MetaModule < Module include Math def method_added(meth) module_function meth end end @module = MetaModule.new def self.run_code(str) @module.send(:module_eval,str) end def self.run_file(file) Utils::open(file) do |f| run_code(f.read) end end def self.compute_formula(col, vals, mods = []) return Dobjects::Dvector.compute_formula(col, vals, [@module] + mods) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ctioga2-0.13.1 | lib/ctioga2/ruby.rb |
ctioga2-0.13 | lib/ctioga2/ruby.rb |