Class: Vnstat::Traffic::Hourly
- Defined in:
- lib/vnstat/traffic/hourly.rb
Overview
A class encapsulating hourly tracking information.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#[](*args) ⇒ Result::Hour
Fetches a single Result::Hour from the collection.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Vnstat::Traffic::Base
Instance Method Details
#[](date, hour) ⇒ Result::Hour #[](year, month, day, hour) ⇒ Result::Hour
Fetches a single Result::Hour from the collection.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vnstat/traffic/hourly.rb', line 22 def [](*args) args_count = args.count hour = args.pop date = case args_count when 2 then args.first when 4 then Date.new(*args) else raise ArgumentError, 'wrong number of arguments ' \ "(#{args_count} for 2 or 4)" end entries_hash[[date, hour]] end |