Sha256: 2dd55461de94458463e7de17529f8e71b7369835d853dec4549e51a6da7ea9ec

Contents?: true

Size: 462 Bytes

Versions: 10

Compression:

Stored size: 462 Bytes

Contents

module Restfulie::Client::Feature::History

  def snapshots
    @snapshots ||= []
  end

  def max_to_remind
    10
  end

  def history(number)
    snapshots[snapshots.size + number] || raise("Undefined snapshot for #{number}, only containing #{@snapshots.size} snapshots.")
  end

  def make_snapshot(request)
    snapshots.shift if snapshot_full?
    snapshots << request
  end
  
  private

  def snapshot_full?
    snapshots.size >= max_to_remind
  end

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 lib/restfulie/client/feature/history.rb
restfulie-1.1.1 lib/restfulie/client/feature/history.rb
restfulie-1.1.0 lib/restfulie/client/feature/history.rb
restfulie-nosqlite-1.0.3 lib/restfulie/client/feature/history.rb
restfulie-1.0.3 lib/restfulie/client/feature/history.rb
restfulie-1.0.0 lib/restfulie/client/feature/history.rb
restfulie-1.0.0.beta5 lib/restfulie/client/feature/history.rb
restfulie-1.0.0.beta4 lib/restfulie/client/feature/history.rb
restfulie-1.0.0.beta1 lib/restfulie/client/feature/history.rb
restfulie-0.1.0.beta1 lib/restfulie/client/feature/history.rb