Class: Vedeu::Cells::HTML Private
- Inherits:
-
Object
- Object
- Vedeu::Cells::HTML
- Includes:
- Vedeu::Common
- Defined in:
- lib/vedeu/cells/support/html.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Presents a Vedeu::Cells member class as a HTML string.
Instance Attribute Summary collapse
- #cell ⇒ Vedeu::Cells readonly protected private
- #options ⇒ Hash readonly protected private
Instance Method Summary collapse
- #background ⇒ String private private
- #end_tag ⇒ String private private
- #foreground ⇒ String private private
- #initialize(cell, options = {}) ⇒ Vedeu::Cells::HTML constructor private
- #start_tag ⇒ String private private
- #style_attribute ⇒ String private private
- #to_html ⇒ String private
- #value ⇒ String private private
Methods included from Vedeu::Common
#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?
Constructor Details
#initialize(cell, options = {}) ⇒ Vedeu::Cells::HTML
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 |
# File 'lib/vedeu/cells/support/html.rb', line 20 def initialize(cell, = {}) @cell = cell @options = || {} end |
Instance Attribute Details
#cell ⇒ Vedeu::Cells (readonly, protected)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/vedeu/cells/support/html.rb', line 34 def cell @cell end |
#options ⇒ Hash (readonly, protected)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 |
# File 'lib/vedeu/cells/support/html.rb', line 38 def @options end |
Instance Method Details
#background ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 46 47 |
# File 'lib/vedeu/cells/support/html.rb', line 43 def background return '' unless cell.respond_to?(:background) cell.background.to_html end |
#end_tag ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 |
# File 'lib/vedeu/cells/support/html.rb', line 50 def end_tag .fetch(:end_tag, '</td>') end |
#foreground ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
55 56 57 58 59 |
# File 'lib/vedeu/cells/support/html.rb', line 55 def foreground return '' unless cell.respond_to?(:foreground) cell.foreground.to_html end |
#start_tag ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
62 63 64 |
# File 'lib/vedeu/cells/support/html.rb', line 62 def start_tag .fetch(:start_tag, '<td') end |
#style_attribute ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
67 68 69 70 71 |
# File 'lib/vedeu/cells/support/html.rb', line 67 def style_attribute return '' if absent?(background) && absent?(foreground) " style='#{background}#{foreground}'" end |
#to_html ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/vedeu/cells/support/html.rb', line 26 def to_html "#{start_tag}#{style_attribute}>#{value}#{end_tag}" end |
#value ⇒ String (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
74 75 76 77 78 79 80 81 82 |
# File 'lib/vedeu/cells/support/html.rb', line 74 def value if cell.respond_to?(:as_html) && present?(cell.as_html) cell.as_html else ' ' end end |