Class: HasHelpers::Alert
- Inherits:
-
Object
- Object
- HasHelpers::Alert
- Includes:
- Attributes, UIAttributes
- Defined in:
- lib/has_helpers/utils/alert.rb
Overview
The class name "Alert" was chosen to match the name of the corresponding entities in Bootstrap.
Constant Summary collapse
- SUCCESS =
:success- INFO =
:info- WARNING =
:warning- DANGER =
:danger- TYPES =
[SUCCESS, INFO, WARNING, DANGER]
Instance Attribute Summary collapse
Attributes included from UIAttributes::HTMLAttributes
Instance Method Summary collapse
- #details ⇒ Object
- #details=(value) ⇒ Object
-
#initialize(*args, **options) ⇒ Alert
constructor
Examples HasHelpers::Alert.new("Detail") HasHelpers::Alert.new("Detail 1", "Detail 2") HasHelpers::Alert.new("Detail 1", "Detail 2", type: HasHelpers::Alert::SUCCESS).
-
#to_partial_path ⇒ Object
ActiveModel interface.
Methods included from HasHelpers::Attributes::GuardedAttributes
Methods included from UIAttributes::HTMLAttributes
Methods included from Attributes
Constructor Details
#initialize(*args, **options) ⇒ Alert
Examples
HasHelpers::Alert.new("Detail") HasHelpers::Alert.new("Detail 1", "Detail 2") HasHelpers::Alert.new("Detail 1", "Detail 2", type: HasHelpers::Alert::SUCCESS)
22 23 24 |
# File 'lib/has_helpers/utils/alert.rb', line 22 def initialize(*args, **) super(details: args, **) end |
Instance Attribute Details
#type ⇒ Object
34 35 36 |
# File 'lib/has_helpers/utils/alert.rb', line 34 def type @type ||= INFO end |
Instance Method Details
#details ⇒ Object
30 31 32 |
# File 'lib/has_helpers/utils/alert.rb', line 30 def details @details ||= [] end |
#details=(value) ⇒ Object
26 27 28 |
# File 'lib/has_helpers/utils/alert.rb', line 26 def details=(value) @details = Array(value) end |
#to_partial_path ⇒ Object
ActiveModel interface
39 40 41 |
# File 'lib/has_helpers/utils/alert.rb', line 39 def to_partial_path "has_helpers/alerts/alert" end |