Class: Interview::ProgressBar
- Defined in:
- lib/interview/progress_bar.rb
Instance Attribute Summary collapse
-
#hidden ⇒ Object
Returns the value of attribute hidden.
-
#html_class ⇒ Object
Returns the value of attribute html_class.
Attributes inherited from Control
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ ProgressBar
constructor
A new instance of ProgressBar.
- #render ⇒ Object
Methods inherited from Control
#ancestors, build, definition, #find_attribute, #find_attribute!, inherited, #set_attributes, #set_defaults
Constructor Details
#initialize(params = {}) ⇒ ProgressBar
Returns a new instance of ProgressBar.
6 7 8 9 10 |
# File 'lib/interview/progress_bar.rb', line 6 def initialize(params={}) super @html_class = [] @html_class << params[:html_class] if params[:html_class] end |
Instance Attribute Details
#hidden ⇒ Object
Returns the value of attribute hidden.
4 5 6 |
# File 'lib/interview/progress_bar.rb', line 4 def hidden @hidden end |
#html_class ⇒ Object
Returns the value of attribute html_class.
4 5 6 |
# File 'lib/interview/progress_bar.rb', line 4 def html_class @html_class end |
Instance Method Details
#render ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/interview/progress_bar.rb', line 12 def render html_class = @html_class html = Builder::XmlMarkup.new opts = { class: "progress" } opts[:class] += " collapse" if @hidden opts[:class] += ' ' + @html_class.join(' ') unless @html_class.empty? html.div opts do html.div '', class: 'progress-bar bar', style: 'width: 0%' end return html.target! end |