Module: MAndM

Defined in:
lib/m_and_m.rb,
lib/m_and_m/server.rb,
lib/m_and_m/version.rb

Defined Under Namespace

Classes: Server

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.c(colour, text) ⇒ Object



16
17
18
# File 'lib/m_and_m.rb', line 16

def self.c colour, text
  text.to_s.foreground colour
end

.executeObject



6
7
8
9
10
# File 'lib/m_and_m.rb', line 6

def self.execute
  Server.new.messages.each do |message|
    puts "#{c :yellow, time(message["at"])} #{c :magenta, message["from"]} said #{c :green, message["message"]}"
  end
end

.time(at) ⇒ Object



12
13
14
# File 'lib/m_and_m.rb', line 12

def self.time at
  Time.at(at).strftime("%d/%b %M:%H:%S")
end