Class: MarkdownUI::Button::Group::Buttons::Element
- Inherits:
-
Object
- Object
- MarkdownUI::Button::Group::Buttons::Element
- Defined in:
- lib/markdown-ui/button/group/buttons/element.rb
Instance Method Summary collapse
-
#initialize(element, content) ⇒ Element
constructor
A new instance of Element.
- #render ⇒ Object
Constructor Details
#initialize(element, content) ⇒ Element
Returns a new instance of Element.
5 6 7 8 |
# File 'lib/markdown-ui/button/group/buttons/element.rb', line 5 def initialize(element, content) @element = element @content = content end |
Instance Method Details
#render ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/markdown-ui/button/group/buttons/element.rb', line 10 def render element = @element.strip content = @content.strip mode = OpenStruct.new( :icon? => !(element =~ /icon/i).nil? ) if element.length == "buttons".length MarkdownUI::Button::Group::Buttons::Standard.new(element, content).render elsif mode.icon? MarkdownUI::Button::Group::Buttons::Icon.new(element, content).render else MarkdownUI::Button::Group::Buttons::Custom.new(element, content).render end end |