lib/bulldog/attachment/maybe.rb in bulldog-0.1.0 vs lib/bulldog/attachment/maybe.rb in bulldog-0.1.1
- old
+ new
@@ -7,11 +7,11 @@
def initialize(record, name, stream)
@record = record
@name = name
@stream = stream
@value = stream && stream.target
- @saved = value.is_a?(SavedFile)
+ @saved = @value.is_a?(SavedFile) || @value.is_a?(MissingFile)
end
attr_reader :record, :name, :stream, :value
#
@@ -37,10 +37,11 @@
#
# Return true if this object wraps the same IO, and is in the
# same state as the given Attachment.
#
def ==(other)
- record == other.record &&
+ other.is_a?(Bulldog::Attachment::Maybe) &&
+ record == other.record &&
name == other.name &&
value == other.value &&
saved? == other.saved?
end