class SatoriLikeDictionary::TemplateContext

template runtime context class

Attributes

events[R]
request[R]

Public Class Methods

new(events, request) click to toggle source

initialize context @param [Events] events events definition @param [OpenStruct] request request hash

# File lib/satori_like_dictionary.rb, line 247
def initialize(events, request)
  @events = events
  @request = request
end

Public Instance Methods

call_to(target_character) click to toggle source

set communication target @param [String] target_character communication target character name

# File lib/satori_like_dictionary.rb, line 267
def call_to(target_character)
  request.__satori_target_character = target_character
end
change_scope() click to toggle source

change character scope

# File lib/satori_like_dictionary.rb, line 253
def change_scope
  scope_info = "__satori_scope_#{self.object_id}"
  request[scope_info] = request[scope_info].nil? || request[scope_info] == 1 ? 0 : 1
  '\\' + request[scope_info].to_s
end
jump_to(target_entry) click to toggle source

jump to entry @param [String] target_entry jump target entry name

# File lib/satori_like_dictionary.rb, line 261
def jump_to(target_entry)
  "(#{target_entry})\\e"
end
method_missing(method_name, *args) click to toggle source

method_missing

Calls superclass method
# File lib/satori_like_dictionary.rb, line 272
def method_missing(method_name, *args)
  if result = method_name.match(/^r(\d+)$/) # r0 -> request.Reference0
    request["Reference#{result[1]}"]
  else
    super
  end
end