Module: RailsAiContext::Serializers::SectionGuard

Defined in:
lib/rails_ai_context/serializers/section_guard.rb

Overview

One home for "can this introspector section be rendered?". A section carrying :error (the introspector raised) or :unavailable (the data source is absent) must be skipped, not rendered as empty-but-real data.

Class Method Summary collapse

Class Method Details

.usable?(data) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/rails_ai_context/serializers/section_guard.rb', line 11

def usable?(data)
  data.is_a?(Hash) && !data[:error] && !data[:unavailable]
end