Module: Gemwarrior::Formatting

Included in:
DrunkMan, Player
Defined in:
lib/gemwarrior/misc/formatting.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.upstyle(str_arr, no_space = false) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gemwarrior/misc/formatting.rb', line 6

def self.upstyle(str_arr, no_space = false)
  if str_arr.is_a? Array
    str_arr_upstyled = []

    str_arr.each do |str_arr_item|
      str_arr_item_upstyled = []
      
      str_arr_item.split(' ').each do |s|
        str_arr_item_upstyled << upstyle_string(s, no_space)
      end

      str_arr_upstyled << str_arr_item_upstyled.join(' ')
    end

    str_arr_upstyled
  else
    upstyle_string(str_arr, no_space)
  end
end

Instance Method Details

#to_hooch(s) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/gemwarrior/misc/formatting.rb', line 26

def to_hooch(s)
  words = s.split(' ')
  words_hooched = []

  words.each do |w|
    if rand(0..100) > 60 and w.length > 1
      w = w.split('')
      w = w.insert(rand(0..w.length-1), '*HIC*')
      w = w.join('')
    end
    words_hooched << w
  end

  words_hooched.join(' ')
end