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.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(backend: nil) ⇒ StatsOperation

Accepts an alternate backend for tests.



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

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

Class Method Details

.call(request) ⇒ Object



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

def self.call(request)
  new.call(request)
end

Instance Method Details

#call(_request) ⇒ Object



21
22
23
# File 'lib/rubino/api/operations/memory/stats_operation.rb', line 21

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