Module: LlmCostTracker::Dashboard::Params
- Defined in:
- app/services/llm_cost_tracker/dashboard/params.rb
Class Method Summary collapse
Class Method Details
.to_hash(value) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/services/llm_cost_tracker/dashboard/params.rb', line 7 def to_hash(value) return {} if value.nil? unsafe_hash = value.try(:to_unsafe_h) return unsafe_hash if unsafe_hash.is_a?(Hash) return value if value.is_a?(Hash) hash = value.try(:to_h) hash.is_a?(Hash) ? hash : {} rescue ArgumentError, TypeError {} end |
.with_indifferent_access(value) ⇒ Object
20 21 22 |
# File 'app/services/llm_cost_tracker/dashboard/params.rb', line 20 def with_indifferent_access(value) to_hash(value).with_indifferent_access end |