Module: Ripl::Rc::SqueezeHistory::Imp

Included in:
U
Defined in:
lib/ripl/rc/squeeze_history.rb

Instance Method Summary collapse

Instance Method Details

#squeeze_history(history) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/ripl/rc/squeeze_history.rb', line 24

def squeeze_history history
  history.to_a.inject([]){ |result, item|
    if result.last == item
      result
    else
      result << item
    end
  }.last(Ripl.config[:rc_squeeze_history_size])
end