class Tataru::SubroutineCompiler
a subroutine for handling a resource
Public Class Methods
new(resource_representation, action)
click to toggle source
# File lib/tataru/subroutine_compiler.rb, line 10 def initialize(resource_representation, action) @rrep = resource_representation @action = action end
Public Instance Methods
base_action()
click to toggle source
# File lib/tataru/subroutine_compiler.rb, line 23 def base_action @action.to_s.split('_')[1].to_s end
body_instructions()
click to toggle source
# File lib/tataru/subroutine_compiler.rb, line 27 def body_instructions [ :clear, *inner_instructions, :return ] end
call_instruction()
click to toggle source
# File lib/tataru/subroutine_compiler.rb, line 48 def call_instruction { call: label } end
desc()
click to toggle source
# File lib/tataru/subroutine_compiler.rb, line 15 def desc @rrep.desc end
inner_instructions()
click to toggle source
# File lib/tataru/subroutine_compiler.rb, line 44 def inner_instructions send :"#{@action}_instructions" end
label()
click to toggle source
# File lib/tataru/subroutine_compiler.rb, line 19 def label "#{@action}_#{@rrep.name}" end
load_resource_instructions()
click to toggle source
# File lib/tataru/subroutine_compiler.rb, line 35 def load_resource_instructions [ { key: :resource_name }, { value: @rrep.name }, { key: :resource_desc }, { value: @rrep.desc.class.name } ] end