Class: RailsObservatory::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- RailsObservatory::ApplicationController
show all
- Defined in:
- app/controllers/rails_observatory/application_controller.rb
Instance Method Summary
collapse
Instance Method Details
#duration ⇒ Object
18
19
20
|
# File 'app/controllers/rails_observatory/application_controller.rb', line 18
def duration
ActiveSupport::Duration.build((session[:duration] || 1.hour).to_i)
end
|
#set_duration ⇒ Object
12
13
14
15
16
|
# File 'app/controllers/rails_observatory/application_controller.rb', line 12
def set_duration
if params[:duration].presence
session[:duration] = params[:duration].to_i
end
end
|
#set_time_range ⇒ Object
6
7
8
9
10
|
# File 'app/controllers/rails_observatory/application_controller.rb', line 6
def set_time_range
TimeSeries.with_slice(duration.seconds.ago..) do
yield
end
end
|