Class: Interview::Text

Inherits:
Control show all
Includes:
HasControls
Defined in:
lib/interview/text.rb

Instance Attribute Summary collapse

Attributes included from HasControls

#controls

Attributes inherited from Control

#parent

Instance Method Summary collapse

Methods included from HasControls

#add_control, #add_controls, included, #siblings

Methods inherited from Control

#ancestors, build, definition, #find_attribute, #find_attribute!, inherited, #set_attributes, #set_defaults

Constructor Details

#initialize(params = {}) ⇒ Text

Returns a new instance of Text.



7
8
9
10
# File 'lib/interview/text.rb', line 7

def initialize(params={})
  @html_class = []
  super
end

Instance Attribute Details

#boldObject

Returns the value of attribute bold.



5
6
7
# File 'lib/interview/text.rb', line 5

def bold
  @bold
end

#html_classObject

Returns the value of attribute html_class.



5
6
7
# File 'lib/interview/text.rb', line 5

def html_class
  @html_class
end

#styleObject

Returns the value of attribute style.



5
6
7
# File 'lib/interview/text.rb', line 5

def style
  @style
end

#textObject

Returns the value of attribute text.



5
6
7
# File 'lib/interview/text.rb', line 5

def text
  @text
end

Instance Method Details

#renderObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/interview/text.rb', line 12

def render
  html = Builder::XmlMarkup.new
  if @style
    opts = {}
    opts[:class] = @html_class.join(' ') unless @html_class.empty?
    html.tag! @style.to_sym, opts do
      render_text(html)
    end
  else
    render_text(html)
  end
  return html.target!
end