Class: RailsLiveDashboard::RequestMethodBadgeComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- RailsLiveDashboard::RequestMethodBadgeComponent
- Defined in:
- app/components/rails_live_dashboard/request_method_badge_component.rb
Constant Summary collapse
- CLASSES =
{ get: 'fill-green-500', post: 'fill-yellow-500', put: 'fill-blue-500', patch: 'fill-indigo-500', delete: 'fill-red-500', head: 'fill-green-500', option: 'fill-purple-500' }.freeze
Instance Method Summary collapse
-
#initialize(method, turbo_stream: false) ⇒ RequestMethodBadgeComponent
constructor
A new instance of RequestMethodBadgeComponent.
Constructor Details
#initialize(method, turbo_stream: false) ⇒ RequestMethodBadgeComponent
Returns a new instance of RequestMethodBadgeComponent.
15 16 17 18 19 20 21 22 |
# File 'app/components/rails_live_dashboard/request_method_badge_component.rb', line 15 def initialize(method, turbo_stream: false) super return if method.nil? @classes = CLASSES[method.downcase.to_sym] @method = "#{method} #{'- Turbo Stream' if turbo_stream}" end |