Class: Alchemy::Admin::Dashboard::Widget

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/alchemy/admin/dashboard/widget.rb

Instance Method Summary collapse

Constructor Details

#initialize(id:, loading: "eager", style: "default", condition: nil) ⇒ Widget

Returns a new instance of Widget.



17
18
19
20
21
22
23
24
25
26
# File 'app/components/alchemy/admin/dashboard/widget.rb', line 17

def initialize(id:, loading: "eager", style: "default", condition: nil)
  @id = id
  @loading = loading
  @style = style
  @condition = condition

  if condition && !condition.respond_to?(:call)
    raise ArgumentError, ":condition argument must be a proc or lambda"
  end
end