Class: PFM::Message::WidthComputer

Inherits:
Object
  • Object
show all
Defined in:
scripts/01450 Systems/00004 Message/00001 Logic/00004 WitdhComputer.rb

Overview

Class that helps to compute the width of the words

Instance Method Summary collapse

Constructor Details

#initialize(text_normal, text_big) ⇒ WidthComputer

Create a new WidthComputer

Parameters:



10
11
12
13
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00004 WitdhComputer.rb', line 10

def initialize(text_normal, text_big)
  @text_normal = text_normal
  @text_big = text_big
end

Instance Method Details

#big_width(text) ⇒ Integer

Get the width of the text when it's big

Parameters:

Returns:



25
26
27
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00004 WitdhComputer.rb', line 25

def big_width(text)
  @text_big.text_width(text)
end

#disposed?Boolean

Tell if any of the text is disposed

Returns:

  • (Boolean)


31
32
33
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00004 WitdhComputer.rb', line 31

def disposed?
  return @text_big.disposed? || @text_normal.disposed?
end

#normal_width(text) ⇒ Integer

Get the normal width of the text

Parameters:

Returns:



18
19
20
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00004 WitdhComputer.rb', line 18

def normal_width(text)
  @text_normal.text_width(text)
end