Class: Interview::TextAttribute
- Defined in:
- lib/interview/text_attribute.rb
Instance Attribute Summary collapse
-
#cut ⇒ Object
Returns the value of attribute cut.
-
#line_break ⇒ Object
Returns the value of attribute line_break.
-
#rows ⇒ Object
Returns the value of attribute rows.
Attributes inherited from Attribute
#align, #caption, #hide_caption, #hide_tooltip, #html_class, #link, #method, #nil_value, #on_changed, #only_for, #style, #surrounding_tag
Attributes inherited from Control
Instance Method Summary collapse
Methods inherited from Attribute
#initialize, #render, #tooltip, #value
Methods inherited from Control
#ancestors, build, definition, #find_attribute, #find_attribute!, inherited, #initialize, #render, #set_attributes, #set_defaults
Constructor Details
This class inherits a constructor from Interview::Attribute
Instance Attribute Details
#cut ⇒ Object
Returns the value of attribute cut.
4 5 6 |
# File 'lib/interview/text_attribute.rb', line 4 def cut @cut end |
#line_break ⇒ Object
Returns the value of attribute line_break.
4 5 6 |
# File 'lib/interview/text_attribute.rb', line 4 def line_break @line_break end |
#rows ⇒ Object
Returns the value of attribute rows.
4 5 6 |
# File 'lib/interview/text_attribute.rb', line 4 def rows @rows end |
Instance Method Details
#render_read ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/interview/text_attribute.rb', line 6 def render_read return '' if value.nil? line_break = @line_break || true value = self.value.gsub(/\n/, '<br/>') if line_break value = value[0..29] + '...' if @cut and value.size > 30 return value.html_safe end |
#render_write ⇒ Object
15 16 17 18 |
# File 'lib/interview/text_attribute.rb', line 15 def render_write rows = @rows || 8 form_builder.text_area @method, class: 'form-control', rows: rows end |