Module: TyranoDsl::Vocabulary

Defined in:
lib/tyrano_dsl/vocabulary.rb

Overview

All the available words of the DSL

Constant Summary collapse

ASK_QUESTION =

Declare a background

:ask_question
CONDITIONAL_JUMP =

Conditional jump

:conditional_jump
DECLARE_BACKGROUND =

Declare a background

:declare_background
DECLARE_CHARACTER =

Declare a character

:declare_character
DECLARE_LABEL =

Declare a label

:declare_label
DECLARE_VARIABLE =

Declare a variable

:declare_variable
DISPLAY_TEXT =

Display some text

:display_text
HIDE_CHARACTER =

Hide a character

:hide_character
HIDE_MESSAGE_WINDOW =

Hide the message window

:hide_message_window
INCLUDE_FILE =

Include another file

:include_file
JUMP =

Jump to a scene

:jump
SET_BACKGROUND =

Set the current background

:set_background
SET_TITLE_SCREEN_BACKGROUND =

Set the background of the title screen

:set_title_screen_background
SET_CHARACTER_STANCE =

Set the stance of a character

:set_character_stance
SHOW_CHARACTER =

Show a character

:show_character
SHOW_MESSAGE_WINDOW =

Show the message window

:show_message_window
START_SCENE =

Start a scene

:start_scene
UPDATE_VARIABLE =

Update a variable

:update_variable
ALL_WORDS =

All the available words

[
    ASK_QUESTION,
    CONDITIONAL_JUMP,
    DECLARE_BACKGROUND,
    DECLARE_CHARACTER,
    DECLARE_LABEL,
    DECLARE_VARIABLE,
    DISPLAY_TEXT,
    HIDE_CHARACTER,
    HIDE_MESSAGE_WINDOW,
    INCLUDE_FILE,
    JUMP,
    SET_BACKGROUND,
    SET_TITLE_SCREEN_BACKGROUND,
    SET_CHARACTER_STANCE,
    SHOW_CHARACTER,
    SHOW_MESSAGE_WINDOW,
    START_SCENE,
    UPDATE_VARIABLE,
].sort.freeze

Class Method Summary collapse

Class Method Details

.get_words_class(class_file_path) ⇒ Object

Get the word class corresponding to the words

Parameters:

  • class_file_path (String)

    name of the class



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/tyrano_dsl/vocabulary.rb', line 67

def self.get_words_class(class_file_path)
  TyranoDsl::Vocabulary::ALL_WORDS.each do |word|
    full_path = "#{class_file_path}/#{word}"
    require_relative full_path
    full_class_name = "TyranoDsl::" + full_path.
        split('_').
        collect(&:capitalize).
        join.
        split('/').
        collect do |c|
      c[0] = c[0].upcase
      c
    end.join('::')
    word_class = Kernel.const_get(full_class_name)
    yield(word, word_class)
  end
end