Class: StoplightAdmin::Actions::Home

Inherits:
Action
  • Object
show all
Defined in:
lib/stoplight_admin/actions/home.rb

Direct Known Subclasses

Stats

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lights_stats:, **deps) ⇒ Home

Returns a new instance of Home.

Parameters:



12
13
14
15
# File 'lib/stoplight_admin/actions/home.rb', line 12

def initialize(lights_stats:, **deps)
  super(**deps)
  @lights_stats = lights_stats
end

Instance Attribute Details

#lights_stats=(value) ⇒ Class<StoplightAdmin::LightsStats>

Returns:



8
9
10
# File 'lib/stoplight_admin/actions/home.rb', line 8

def lights_stats
  @lights_stats
end

Instance Method Details

#call(StoplightAdmin::LightsRepository::Light)



18
19
20
21
22
# File 'lib/stoplight_admin/actions/home.rb', line 18

def call(*)
  lights = lights_repository.all
  stats = lights_stats.call(lights)
  [lights, stats]
end