Class: Rubino::API::Operations::Memory::StatsOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/rubino/api/operations/memory/stats_operation.rb

Overview

GET /v1/memory/stats Returns the active backend’s name and total fact count — the data the CLI /status line and the web dashboard’s memory card need without paging the whole store.

Instance Method Summary collapse

Constructor Details

#initialize(backend: nil) ⇒ StatsOperation

Accepts an alternate backend for tests.



13
14
15
# File 'lib/rubino/api/operations/memory/stats_operation.rb', line 13

def initialize(backend: nil)
  @backend = backend || ::Rubino::Memory::Backends.build
end

Instance Method Details

#call(_request) ⇒ Object



17
18
19
# File 'lib/rubino/api/operations/memory/stats_operation.rb', line 17

def call(_request)
  [200, { backend: @backend.class.backend_name, count: @backend.count }]
end