Class: FoxPage::Helpers::TagHelper::TagBuilder
- Inherits:
-
Object
- Object
- FoxPage::Helpers::TagHelper::TagBuilder
- Defined in:
- lib/fox_page/helpers/tag_helper.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(name:, content: nil, options: {}) ⇒ TagBuilder
constructor
A new instance of TagBuilder.
Constructor Details
#initialize(name:, content: nil, options: {}) ⇒ TagBuilder
Returns a new instance of TagBuilder.
7 8 9 10 11 |
# File 'lib/fox_page/helpers/tag_helper.rb', line 7 def initialize(name:, content: nil, options: {}) @name = name @content = content @options = end |
Instance Method Details
#build ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fox_page/helpers/tag_helper.rb', line 13 def build [ "<", [ @name.to_s, *@options.compact.map(&method(:tag_option)), ].join(" "), ">", @content, "</", @name.to_s, ">" ].join("") end |