Class: MarkdownUI::Button::Group::Buttons::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/markdown-ui/button/group/buttons/element.rb

Instance Method Summary collapse

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

#renderObject



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