Class: Adhoq::Report

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/adhoq/report.rb

Instance Method Summary collapse

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/models/adhoq/report.rb', line 19

def available?
  identifier.present? && (storage == Adhoq.current_storage.identifier)
end

#data(storage = Adhoq.current_storage) ⇒ Object



23
24
25
# File 'app/models/adhoq/report.rb', line 23

def data(storage = Adhoq.current_storage)
  storage.get(identifier)
end

#data_url(storage = Adhoq.current_storage) ⇒ Object



27
28
29
# File 'app/models/adhoq/report.rb', line 27

def data_url(storage = Adhoq.current_storage)
  storage.get_url(self)
end

#generate!(storage = Adhoq.current_storage) ⇒ Object



7
8
9
10
11
12
13
# File 'app/models/adhoq/report.rb', line 7

def generate!(storage = Adhoq.current_storage)
  self.identifier   = generate_and_persist_report!(storage)
  self.generated_at = Time.now
  self.storage      = storage.identifier

  save!
end

#mime_typeObject



31
32
33
# File 'app/models/adhoq/report.rb', line 31

def mime_type
  Adhoq::Reporter.lookup(execution.report_format).mime_type
end

#on_the_fly?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/models/adhoq/report.rb', line 15

def on_the_fly?
  storage.start_with?(Adhoq::Storage::OnTheFly::PREFIX)
end