Class: SinatraListener
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- SinatraListener
- Defined in:
- lib/post2irc/sinatra_listener.rb
Constant Summary collapse
- UNAUTHORIZED =
[ 401, 'unauthorized']
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.start(bind = '0.0.0.0', port = '4567', token = 'public') ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/post2irc/sinatra_listener.rb', line 5 def self.start(bind='0.0.0.0',port='4567',token='public') @@token = token configure :production, :development do enable :logging set :port, port set :bind, bind end self.run! end |
Instance Method Details
#authorized?(prefix) ⇒ Boolean
20 21 22 |
# File 'lib/post2irc/sinatra_listener.rb', line 20 def (prefix) @@token == prefix end |
#string_cleaner(message) ⇒ Object
15 16 17 18 |
# File 'lib/post2irc/sinatra_listener.rb', line 15 def string_cleaner() #remove all non printable characters and replace with a dot .gsub /[^[:print:]]/m, "." end |