0
0
Fork 0

Add a storage

This storage should contain the weighted data, before it it's used in the
output classes. So we can create a timeline.
Plus we have a nice place to store the weighted data.
This commit is contained in:
Stormwind 2015-02-23 21:54:01 +01:00
parent a80c46c5c9
commit 6702a58851
1 changed files with 30 additions and 0 deletions

30
lib/rubella/storage.rb Normal file
View File

@ -0,0 +1,30 @@
module Rubella
# The Rubella::Storage holds the weighted data.
# Storages can be added to get a timeline. But the Storage has no concrete
# knowledge of time.
# The Storage can have a defined length. If new data is added, it will drop
# the oldest entries.
#
class Storage
attr_reader :data
attr_reader :length
def initialize data, length = nil
@data = data
self.length = length
end
# Defines the length of the Storage.
# Be careful, if your Storage has more entries, tha the new length, the
# oldest entries will immediately be dropped.
#
def length= length
@length = length
# TODO drop entries, if more than new length
end
end
end