Class: Ominous::Warning
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Ominous::Warning
show all
- Defined in:
- app/models/ominous/warning.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args, &block) ⇒ Object
47
48
49
50
51
52
53
|
# File 'app/models/ominous/warning.rb', line 47
def method_missing(symbol, *args, &block)
if acts_as_list_method?(symbol)
pass_method_to_warning_closer(symbol, args.first)
else
super
end
end
|
Class Method Details
.after_action_tasks ⇒ Object
Called after each controller action.
38
39
40
|
# File 'app/models/ominous/warning.rb', line 38
def self.after_action_tasks
clear_requests end
|
.clear_requests ⇒ Object
33
34
35
|
# File 'app/models/ominous/warning.rb', line 33
def self.clear_requests
@requests = []
end
|
.requests ⇒ Object
29
30
31
|
# File 'app/models/ominous/warning.rb', line 29
def self.requests
@requests ||= []
end
|
.trigger(name) ⇒ Object
22
23
24
25
26
27
|
# File 'app/models/ominous/warning.rb', line 22
def self.trigger(name)
unless exists?(:name => name)
raise "Attempt to trigger warning failed: #{name} not recognised"
end
requests << name.to_sym
end
|
Instance Method Details
#title ⇒ Object
42
43
44
|
# File 'app/models/ominous/warning.rb', line 42
def title
(super.blank? and name?) ? name.humanize : super
end
|