Class: MAndM::Cli
- Inherits:
-
Object
- Object
- MAndM::Cli
- Defined in:
- lib/m_and_m/cli.rb
Instance Attribute Summary collapse
-
#preferences ⇒ Object
readonly
Returns the value of attribute preferences.
Instance Method Summary collapse
- #execute(*args) ⇒ Object
-
#initialize ⇒ Cli
constructor
A new instance of Cli.
- #list ⇒ Object
- #say(who, message_id) ⇒ Object
Constructor Details
#initialize ⇒ Cli
Returns a new instance of Cli.
9 10 11 |
# File 'lib/m_and_m/cli.rb', line 9 def initialize @preferences = MAndM::Preferences.new '.m_and_m' end |
Instance Attribute Details
#preferences ⇒ Object (readonly)
Returns the value of attribute preferences.
7 8 9 |
# File 'lib/m_and_m/cli.rb', line 7 def preferences @preferences end |
Instance Method Details
#execute(*args) ⇒ Object
13 14 15 16 17 |
# File 'lib/m_and_m/cli.rb', line 13 def execute *args command = args.shift command = :list unless command send command, *args end |
#list ⇒ Object
19 20 21 22 23 |
# File 'lib/m_and_m/cli.rb', line 19 def list server..each do || puts "#{c :yellow, time(["at"])} #{c :magenta, ["from"]} said #{c :green, ["message"]}" end end |
#say(who, message_id) ⇒ Object
25 26 27 |
# File 'lib/m_and_m/cli.rb', line 25 def say who, server.say uuid_for(who), end |