예제 #1
0
파일: ruby.py 프로젝트: rspadim/m2cgen
    def __init__(self, model):
        self.model = model
        self.interpreter = interpreters.RubyInterpreter()

        assembler_cls = assemblers.get_assembler_cls(model)
        self.model_ast = assembler_cls(model).assemble()

        self._ruby = "ruby"
예제 #2
0
    def __init__(self, model):
        self.model_name = "score"
        self.model = model
        self.interpreter = interpreters.RubyInterpreter()

        assembler_cls = assemblers.get_assembler_cls(model)
        self.model_ast = assembler_cls(model).assemble()

        self.script_path = None
예제 #3
0
def export_to_ruby(model, indent=4, function_name="score"):
    """
    Generates a Ruby code representation of the given model.

    Parameters
    ----------
    model : object
        The model object that should be transpiled into code.
    indent : int, optional
        The size of indents in the generated code.
    function_name : string, optional
        Name of the function in the generated code.

    Returns
    -------
    code : string
    """
    interpreter = interpreters.RubyInterpreter(
        indent=indent,
        function_name=function_name,
    )
    return _export(model, interpreter)