Class: RailsAiBridge::Serializers::ContextSummary::DatabaseSize::BucketLabel
- Inherits:
-
Object
- Object
- RailsAiBridge::Serializers::ContextSummary::DatabaseSize::BucketLabel
- Defined in:
- lib/rails_ai_bridge/serializers/context_summary.rb
Overview
Value object for mapping an approximate row count to a safe label.
Instance Method Summary collapse
-
#initialize(row_count) ⇒ BucketLabel
constructor
A new instance of BucketLabel.
-
#label ⇒ String?
Safe size bucket label.
Constructor Details
#initialize(row_count) ⇒ BucketLabel
Returns a new instance of BucketLabel.
420 421 422 |
# File 'lib/rails_ai_bridge/serializers/context_summary.rb', line 420 def initialize(row_count) @value = row_count end |
Instance Method Details
#label ⇒ String?
Returns safe size bucket label.
425 426 427 428 429 430 |
# File 'lib/rails_ai_bridge/serializers/context_summary.rb', line 425 def label return @value if SAFE_LABELS.include?(@value) return nil unless rows BUCKETS.find { |range, _bucket| range.cover?(rows) }&.last || 'hot' end |