Module: PFM::Message::Parser

Included in:
State, UI::Message::Window
Defined in:
docs/4_Systems_004_Message.rb

Overview

Module parsing a message to a set of instruction the message displayer can show

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.code_replacerArray<Proc> (readonly)

Get the list of code replacer

Returns:

  • (Array<Proc>)


78
79
80
# File 'docs/4_Systems_004_Message.rb', line 78

def code_replacer
  @code_replacer
end

Class Method Details

.register_marker(regexp, code) {|captures| ... }

Note:

If no block is given, the function will assume the regexp has 1 match

Register a text marker to make text easier to parse

Parameters:

  • regexp (Regexp)

    regexp to parse

  • code (Integer)

    code to use for easier parsing (must be positive integer)

Yield Parameters:

  • captures (Array<String>)

    list of all captures from the regexp

Yield Returns:

  • (Array)

    array of element not containing “[” or “]”



85
86
# File 'docs/4_Systems_004_Message.rb', line 85

def register_marker(regexp, code)
end

Instance Method Details

#convert_text_to_properties(text) ⇒ Message::Properties

Function that parses the message text so it’s easier to work with it

Parameters:

  • text (String)

    original message text

Returns:



67
68
# File 'docs/4_Systems_004_Message.rb', line 67

def convert_text_to_properties(text)
end

#make_instructions(properties, width, width_computer)

Function that generate the instructions based on properties & text surface

Parameters:

  • properties (Properties)

    Message box properties

  • width (Integer)

    width of the surface used to draw the message

  • width_computer (WidthComputer)

    object helping to compute the width of the words



73
74
# File 'docs/4_Systems_004_Message.rb', line 73

def make_instructions(properties, width, width_computer)
end