Class: GamesAndRpgParadise::Mud::Base
- Inherits:
-
Object
- Object
- GamesAndRpgParadise::Mud::Base
show all
- Defined in:
- lib/games_and_rpg_paradise/mud/base/base.rb
Instance Method Summary
collapse
Instance Method Details
#find_adverb_for(i) ⇒ Object
#lang_wnum(i) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/games_and_rpg_paradise/mud/base/base.rb', line 14
def lang_wnum(i)
case i
when 1
'one'
when 2
'two'
when 3
'three'
when 4
'four'
when 5
'five'
when 6
'six'
when 7
'seven'
end
end
|
#sentence(i = '') ⇒ Object
#
sentence
Formulate a proper sentence. A proper sentence will terminate with a colon.
#
39
40
41
42
|
# File 'lib/games_and_rpg_paradise/mud/base/base.rb', line 39
def sentence(i = '')
i << '.' unless i.end_with? '.'
e i
end
|
#word_wrap(i, max_line_width = 80, optional_padding = '') ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/games_and_rpg_paradise/mud/base/base.rb', line 47
def word_wrap(
i, max_line_width = 80, optional_padding = ''
)
your_text = i.split("\n").map {|line|
line.size > max_line_width ? line.gsub(/(.{1,#{max_line_width}})(\s+|$)/,
optional_padding+"\\1\n").chomp : line
}
your_text * "\n"
end
|