Class: Rmpd::Command::Splitter

Inherits:
Object
  • Object
show all
Defined in:
lib/rmpd/command.rb

Instance Method Summary collapse

Constructor Details

#initialize(regexp) ⇒ Splitter

Returns a new instance of Splitter.



183
184
185
# File 'lib/rmpd/command.rb', line 183

def initialize(regexp)
  @regexp = regexp
end

Instance Method Details

#split(lines) ⇒ Object



187
188
189
190
191
192
193
194
195
196
# File 'lib/rmpd/command.rb', line 187

def split(lines)
  lines.reduce([]) do |c, i|
    if @regexp === i
      c << [i]
    else
      c.last << i
    end
    c
  end
end