Class: Decidim::Toggle::InformativeCallouts::InformativeEntry
- Inherits:
-
Object
- Object
- Decidim::Toggle::InformativeCallouts::InformativeEntry
- Defined in:
- lib/decidim/toggle/informative_callouts.rb
Instance Attribute Summary collapse
-
#if_predicate ⇒ Object
readonly
Returns the value of attribute if_predicate.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, message:, if_predicate: nil) ⇒ InformativeEntry
constructor
A new instance of InformativeEntry.
- #message_for(form) ⇒ Object
- #visible?(form) ⇒ Boolean
Constructor Details
#initialize(type:, message:, if_predicate: nil) ⇒ InformativeEntry
Returns a new instance of InformativeEntry.
30 31 32 33 34 |
# File 'lib/decidim/toggle/informative_callouts.rb', line 30 def initialize(type:, message:, if_predicate: nil) @type = type @message = @if_predicate = if_predicate end |
Instance Attribute Details
#if_predicate ⇒ Object (readonly)
Returns the value of attribute if_predicate.
28 29 30 |
# File 'lib/decidim/toggle/informative_callouts.rb', line 28 def if_predicate @if_predicate end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
28 29 30 |
# File 'lib/decidim/toggle/informative_callouts.rb', line 28 def @message end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
28 29 30 |
# File 'lib/decidim/toggle/informative_callouts.rb', line 28 def type @type end |
Instance Method Details
#message_for(form) ⇒ Object
42 43 44 |
# File 'lib/decidim/toggle/informative_callouts.rb', line 42 def (form) form.public_send() end |
#visible?(form) ⇒ Boolean
36 37 38 39 40 |
# File 'lib/decidim/toggle/informative_callouts.rb', line 36 def visible?(form) return true if if_predicate.nil? if_predicate.call(form) end |