Class: HasHelpers::Alert

Inherits:
Object
  • Object
show all
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

#data, #skin

Instance Method Summary collapse

Methods included from HasHelpers::Attributes::GuardedAttributes

included

Methods included from UIAttributes::HTMLAttributes

#raw_html_attrs

Methods included from Attributes

included

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, **options)
  super(details: args, **options)
end

Instance Attribute Details

#typeObject



34
35
36
# File 'lib/has_helpers/utils/alert.rb', line 34

def type
  @type ||= INFO
end

Instance Method Details

#detailsObject



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_pathObject

ActiveModel interface



39
40
41
# File 'lib/has_helpers/utils/alert.rb', line 39

def to_partial_path
  "has_helpers/alerts/alert"
end