Class: Schatter::RootContext

Inherits:
Object
  • Object
show all
Includes:
Command, ShellShock::Context
Defined in:
lib/schatter/root_context.rb

Instance Method Summary collapse

Methods included from Command

#classify, #load_command

Constructor Details

#initialize(url = nil) ⇒ RootContext

Returns a new instance of RootContext.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/schatter/root_context.rb', line 10

def initialize url=nil
  url = "http://localhost:3000" unless url
  unless ENV['SCHATTER_AUTH_TOKEN']
    puts "Please register at #{url} and set environment variable SCHATTER_AUTH_TOKEN"
    exit 1
  end
  @prompt = "schatter.#{Schatter::VERSION} #{url}> "
  session = Schatter::Session.new url: url
  add_command load_command(:list_conversations, session), "'"
  add_command load_command(:join_conversation, session), 'join'
  add_command load_command(:create_conversation, session), 'create'
end