Sha256: c783bca4149632aa330941d2fb8825829f5ef572e8e0e2c7878c15402b44d926

Contents?: true

Size: 645 Bytes

Versions: 30

Compression:

Stored size: 645 Bytes

Contents

module Pageflow
  class UsedFile < SimpleDelegator
    def initialize(file, usage = nil)
      super(file)
      @file = file
      @usage = usage || file.usages.first
    end

    def configuration
      @usage.configuration
    end

    def update_attributes!(attributes)
      super(attributes.except(:configuration))
      @usage.update_attributes!(attributes.slice(:configuration))
    end

    def usage_id
      @usage.id
    end

    # Not delegated by default. Required to allow using instances in
    # Active Record conditions.

    def is_a?(klass)
      @file.is_a?(klass)
    end

    def class
      @file.class
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
pageflow-14.5.2 app/models/pageflow/used_file.rb
pageflow-14.5.1 app/models/pageflow/used_file.rb
pageflow-14.5.0 app/models/pageflow/used_file.rb
pageflow-14.4.0 app/models/pageflow/used_file.rb
pageflow-14.3.0 app/models/pageflow/used_file.rb
pageflow-14.2.1 app/models/pageflow/used_file.rb
pageflow-14.2.0 app/models/pageflow/used_file.rb
pageflow-14.1.1 app/models/pageflow/used_file.rb
pageflow-14.1.0 app/models/pageflow/used_file.rb
pageflow-14.0.0 app/models/pageflow/used_file.rb
pageflow-14.0.0.rc2 app/models/pageflow/used_file.rb
pageflow-14.0.0.rc1 app/models/pageflow/used_file.rb
pageflow-14.0.0.beta3 app/models/pageflow/used_file.rb
pageflow-14.0.0.beta2 app/models/pageflow/used_file.rb
pageflow-14.0.0.beta1 app/models/pageflow/used_file.rb
pageflow-13.6.0 app/models/pageflow/used_file.rb
pageflow-13.5.0 app/models/pageflow/used_file.rb
pageflow-13.4.0 app/models/pageflow/used_file.rb
pageflow-13.3.0 app/models/pageflow/used_file.rb
pageflow-13.2.0 app/models/pageflow/used_file.rb