Module: Vehicles::Providers::LocalProvider

Defined in:
lib/vehicles/providers/local_provider.rb

Overview

The always-available provider, backed by the bundled dataset. It answers whatever the local snapshot knows and returns nil for everything it doesn’t (years/segment/image today) — which is exactly what makes graceful degradation work: the hosted provider enriches, this one guarantees the gem never breaks when the hosted data is absent.

Class Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/vehicles/providers/local_provider.rb', line 13

def available?
  true
end

.image(_model, year:, color:) ⇒ Object



22
# File 'lib/vehicles/providers/local_provider.rb', line 22

def image(_model, year:, color:) = nil

.segment(_model) ⇒ Object



21
# File 'lib/vehicles/providers/local_provider.rb', line 21

def segment(_model)             = nil

.years(_model) ⇒ Object

The bundled snapshot is make/model/kind/body_type only — richer fields come from the hosted API. Returning nil here lets the resolver move on (and ultimately yield nil) instead of raising.



20
# File 'lib/vehicles/providers/local_provider.rb', line 20

def years(_model)               = nil