Class: APCStatsReport
- Inherits:
-
Object
- Object
- APCStatsReport
- Defined in:
- lib/apc-report-parser.rb
Overview
The loader and parser should be factored out, but this is good enough for now
Instance Method Summary collapse
-
#initialize(uri = "http://localhost:80/apc.php", lazy_load = true) ⇒ APCStatsReport
constructor
A new instance of APCStatsReport.
- #report ⇒ Object
- #retrieve_report! ⇒ Object
Constructor Details
#initialize(uri = "http://localhost:80/apc.php", lazy_load = true) ⇒ APCStatsReport
Returns a new instance of APCStatsReport.
13 14 15 16 |
# File 'lib/apc-report-parser.rb', line 13 def initialize(uri="http://localhost:80/apc.php", lazy_load=true) @uri = URI.parse(uri) @lazy_load = lazy_load end |
Instance Method Details
#report ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/apc-report-parser.rb', line 25 def report if @report.nil? raise ReportNotInitializedError unless @lazy_load retrieve_report! end @report end |
#retrieve_report! ⇒ Object
18 19 20 21 22 23 |
# File 'lib/apc-report-parser.rb', line 18 def retrieve_report! resource = Net::HTTP.start(@uri.host, @uri.port) do |http| http.get(@uri.path) end @report = parse_resource_into_report(resource) end |