module Alki::Execution::ContextClassBuilder
Public Class Methods
build(config)
click to toggle source
# File lib/alki/execution/context_class_builder.rb, line 7 def self.build(config) if config[:body] methods = { __call__: {body: (config[:body])}, meta: {body: ->{@__meta__}} } else methods = {} end (config[:lookup_methods]||config[:scope]||{}).each do |name,path| methods[name] = { body:->(*args,&blk) { __execute__ path, args, blk } } methods[:"__raw_#{name}__"] = { body:->(*args,&blk) { __executor__.execute @__meta__, path, args, blk }, private: true } methods[:"__reference_#{name}__"] = { body:->(*args,&blk) { __reference__ path, args, blk }, } end (config[:methods]||{}).each do |name,body| methods[name] = { body: body, private: name.to_s.start_with?('__'), } end ClassBuilder.build( super_class: Alki::Execution::Context, modules: config[:modules], instance_methods: methods, ) end