aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app/models/active_storage/blob/identifiable.rb
blob: dbe03cfa6c925606e356498a8b266e8abd991147 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

module ActiveStorage::Blob::Identifiable
  def identify
    update!(content_type: identification.content_type, identified: true) unless identified?
  end

  def identified?
    identified
  end

  private
    def identification
      ActiveStorage::Identification.new self
    end
end