PageRenderTime 49ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/plugins/gsub.rb

https://github.com/Epictetus/termtter
Ruby | 17 lines | 14 code | 2 blank | 1 comment | 1 complexity | 765db80c041c1ff9122aef0bb0435b1f MD5 | raw file
  1. # -*- coding: utf-8 -*-
  2. config.plugins.gsub.set_default(:table, [
  3. [/([])(?=\S)/, '\1 '],
  4. [/(?=\S)(https?:\/\/)/, ' \1'],
  5. ])
  6. Termtter::Client.register_hook(
  7. :name => :gsub,
  8. :point => :filter_for_output,
  9. :exec => lambda {|statuses, event|
  10. statuses.each do |s|
  11. t = s.text
  12. config.plugins.gsub.table.each {|a, b| t.gsub!(a, b || '') }
  13. end
  14. }
  15. )