Class: Pageflow::UsedFile

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/models/pageflow/used_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(file, usage = nil) ⇒ UsedFile

Returns a new instance of UsedFile.



3
4
5
6
# File 'app/models/pageflow/used_file.rb', line 3

def initialize(file, usage = nil)
  super(file)
  @usage = usage || file.usages.first
end

Instance Method Details

#configurationObject



8
9
10
# File 'app/models/pageflow/used_file.rb', line 8

def configuration
  @usage.configuration
end

#update_attributes!(attributes) ⇒ Object



12
13
14
15
# File 'app/models/pageflow/used_file.rb', line 12

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

#usage_idObject



17
18
19
# File 'app/models/pageflow/used_file.rb', line 17

def usage_id
  @usage.id
end