Class: Ticket::Glance
- Inherits:
-
Object
- Object
- Ticket::Glance
- Defined in:
- app/models/ticket/glance.rb
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(parent) ⇒ Glance
constructor
A new instance of Glance.
Constructor Details
#initialize(parent) ⇒ Glance
Returns a new instance of Glance.
22 23 24 |
# File 'app/models/ticket/glance.rb', line 22 def initialize(parent) @parent = parent end |
Class Method Details
.report(reports) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/models/ticket/glance.rb', line 2 def self.report(reports) reports.each do |mthd, klass| # Define the getter method for this report class_eval(" def \#{mthd}\n @\#{mthd} ||= \#{klass}.new(@parent)\n end\n EOS\n\n # Delegate methods to the created method\n delegate(*klass.reporting_methods, :prefix => true, :to => mthd)\n end\nend\n", __FILE__, __LINE__) |
Instance Method Details
#as_json(options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'app/models/ticket/glance.rb', line 26 def as_json( ={}) { :tickets => { :comped => comped.total, :available => available.total, :sold => { :gross => sales.total } } } end |