Method: Code::Object::String#code_to_function

Defined in:
lib/code/object/string.rb

#code_to_function(**globals) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/code/object/string.rb', line 66

def code_to_function(**globals)
  Code::Node::Code.new(
    [
      {
        function: {
          parameters: [{ name: "_" }],
          body: [
            {
              left_operation: {
                first: {
                  call: {
                    name: "_"
                  }
                },
                others: [
                  { operator: ".", statement: { call: { name: raw } } }
                ]
              }
            }
          ]
        }
      }
    ]
  ).evaluate(**globals)
end