Module: IRC::RFC2812::Commands::Helpers

Defined in:
lib/irc/rfc2812/commands.rb

Constant Summary collapse

MAX_LENGTH =
510

Class Method Summary collapse

Class Method Details

.splitted(prefix, trail) ⇒ Object


25
26
27
28
29
30
31
# File 'lib/irc/rfc2812/commands.rb', line 25

def self.splitted(prefix, trail)
  len = MAX_LENGTH - prefix.length - 4 # CLRF and " :"

  trail.scan(/.{0,#{len}}/).reject(&:empty?).inject("") do |a, t|
    a << prefix << " :" << t << "\r\n"
  end
end