Class: Effective::ReportScope

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/effective/report_scope.rb

Instance Method Summary collapse

Instance Method Details

#apply_scope(collection) ⇒ Object



67
68
69
# File 'app/models/effective/report_scope.rb', line 67

def apply_scope(collection)
  value.nil? ? collection.send(name) : collection.send(name, value)
end

#operation_labelObject



63
64
65
# File 'app/models/effective/report_scope.rb', line 63

def operation_label
  return '=' if advanced?
end

#to_sObject



55
56
57
# File 'app/models/effective/report_scope.rb', line 55

def to_s
  [name, operation_label, value].compact.join(' ').presence || 'report scope'
end

#valueObject



59
60
61
# File 'app/models/effective/report_scope.rb', line 59

def value
  value_date || value_decimal || value_integer || value_price || value_string.presence || value_boolean
end