Class: MarkdownUI::Button::Focusable
- Inherits:
-
Object
- Object
- MarkdownUI::Button::Focusable
- Defined in:
- lib/markdown-ui/button/focusable.rb
Instance Method Summary collapse
-
#initialize(content, klass = nil, _id = nil) ⇒ Focusable
constructor
A new instance of Focusable.
- #render ⇒ Object
Constructor Details
#initialize(content, klass = nil, _id = nil) ⇒ Focusable
Returns a new instance of Focusable.
5 6 7 8 9 |
# File 'lib/markdown-ui/button/focusable.rb', line 5 def initialize(content, klass = nil, _id = nil) @klass = klass @content = content @id = _id end |
Instance Method Details
#render ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/markdown-ui/button/focusable.rb', line 11 def render content = MarkdownUI::Content::Parser.new(@content).parse klass = MarkdownUI::KlassUtil.new("ui #{@klass} button").klass _id = if @id " id=\"#{@id.split.join("-")}\"" end output = [] output << "<button" output << "#{_id}" output << "#{klass}>" output << content output << "</button>" output.join end |