Class: Blazer::Query
- Defined in:
- app/models/blazer/query.rb
Instance Method Summary collapse
- #cohort_analysis? ⇒ Boolean
- #editable?(user) ⇒ Boolean
- #friendly_name ⇒ Object
- #statement_object ⇒ Object
- #to_param ⇒ Object
- #variables ⇒ Object
Instance Method Details
#cohort_analysis? ⇒ Boolean
33 34 35 36 |
# File 'app/models/blazer/query.rb', line 33 def cohort_analysis? # don't require data_source to be loaded Statement.new(statement).cohort_analysis? end |
#editable?(user) ⇒ Boolean
22 23 24 |
# File 'app/models/blazer/query.rb', line 22 def editable?(user) !persisted? || (name.present? && name.first != "*" && name.first != "#") || user == try(:creator) end |
#friendly_name ⇒ Object
18 19 20 |
# File 'app/models/blazer/query.rb', line 18 def friendly_name name.to_s.sub(/\A[#\*]/, "").gsub(/\[.+\]/, "").strip end |
#statement_object ⇒ Object
38 39 40 |
# File 'app/models/blazer/query.rb', line 38 def statement_object Statement.new(statement, data_source) end |
#to_param ⇒ Object
14 15 16 |
# File 'app/models/blazer/query.rb', line 14 def to_param [id, name].compact.join("-").gsub("'", "").parameterize end |