class Mingle::HistoricalAttachments

Public Class Methods

new(path) click to toggle source
# File lib/mingle/historical_attachments.rb, line 7
def initialize(path)
  @path = path
  @attachments = []
  Dir[File.join(@path, 'attachments_*.yml')].each do |file|
    @attachments += YAML.load_file(file)
  end
end

Public Instance Methods

find_by_id(id) click to toggle source
# File lib/mingle/historical_attachments.rb, line 19
def find_by_id(id)
  attachment = @attachments.find { |attachment| attachment['id'].to_s == id.to_s }
  Attachment.new(attachment['file']) if attachment
end
size() click to toggle source
# File lib/mingle/historical_attachments.rb, line 15
def size
  @attachments.size
end