Module: MxitRails::Styles

Defined in:
lib/mxit_rails/styles.rb

Constant Summary collapse

StyleList =

Not sure whether a Constant is the neatest/nicest way of storing these?

{}
Emoticons =
{
  happy: [':)', ':-)'],
  sad: [':(', ':-('],
  winking: [";)", ";-)"],
  excited: [':D', ':-D'],
  shocked: [':|', ':-|'],
  surprised: [':O', ':-O'],
  tongue_out: [':P', ':-P'],
  embarrassed: [':$', ':-$'],
  cool: ['8-)'],
  heart: ['(H)'],
  flower: ['(F)'],

  # V 3.0. smileys
  male: ['(m)'],
  female: ['(f)'],
  star: ['(*)'],
  chilli: ['(c)'],
  kiss: ['(x)'],
  idea: ['(i)'],
  extremely_angry: [':e', ':-e'],
  censored: [':x', ':-x'],
  grumpy: ['(z)'],
  coffee: ['(U)'],
  mr_green: ['(G)'],

  # V 5.0 smileys
  sick: [':o('],
  wtf: [':{', ':-{'],
  in_love: [':}', ':-}'],
  rolling_eyes: ['8-o', '8o'],
  crying: [':\'('],
  thinking: [':?', ':-?'],
  drooling: [':~', ':-~'],
  sleepy: [':z', ':-z'],
  liar: [':L)'],
  nerdy: ['8-|', '8|'],
  pirate: ['P-)'],
  bored: [':[', ':-['],
  cold: [':<', ':-<'],
  confused: [':,', ':-,'],
  hungry: [':C', ':-C'],
  stressed: [':s', ':-s'],
}

Class Method Summary collapse

Class Method Details

.add(name, content) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/mxit_rails/styles.rb', line 11

def self.add name, content
  content.strip!
  if content[-1] != ';'
    content += ';'
  end
  StyleList[name.to_sym] = content
end

.add_emoticons(source) ⇒ Object



64
65
66
67
68
69
70
71
72
# File 'lib/mxit_rails/styles.rb', line 64

def self.add_emoticons source
  output = source
  Emoticons.each do |name, searches|
    searches.each do |search|
      output.gsub! search, "<span class=\"emoticon #{name}\" title=\"#{name} #{search}\">#{search}</span>"
    end
  end
  output
end

.get(name) ⇒ Object



7
8
9
# File 'lib/mxit_rails/styles.rb', line 7

def self.get name
  StyleList[name.to_sym]
end