Class: DismissibleHelpers::ContentBuilder
- Inherits:
-
Object
- Object
- DismissibleHelpers::ContentBuilder
- Includes:
- ActionView::Context, ActionView::Helpers::TagHelper, ActionView::Helpers::TranslationHelper
- Defined in:
- lib/dismissible_helpers/content_builder.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
- #build_markup ⇒ Object
-
#initialize(name, contents = nil, options = {}) ⇒ ContentBuilder
constructor
A new instance of ContentBuilder.
Constructor Details
#initialize(name, contents = nil, options = {}) ⇒ ContentBuilder
Returns a new instance of ContentBuilder.
10 11 12 13 14 |
# File 'lib/dismissible_helpers/content_builder.rb', line 10 def initialize(name, contents=nil, ={}) @name = name @contents = contents @options = end |
Class Method Details
.build(*args) ⇒ Object
6 7 8 |
# File 'lib/dismissible_helpers/content_builder.rb', line 6 def self.build(*args) self.new(*args).build end |
Instance Method Details
#build ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/dismissible_helpers/content_builder.rb', line 16 def build = {} [:class] = 'dismissible' [:data] = {:dismissible_name => @name, :restorable => restorable?} html = build_markup content_tag :div, html, end |
#build_markup ⇒ Object
24 25 26 |
# File 'lib/dismissible_helpers/content_builder.rb', line 24 def build_markup return [content_str, dismissed? ? '' : close_str].join.html_safe end |