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 ⇒ void readonly protected private
- #options ⇒ Hash readonly protected private
Instance Method Summary collapse
-
#absent?(variable) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether a variable is nil or empty.
- #background ⇒ String private private
-
#become(klass, attributes) ⇒ Class
included
from Vedeu::Common
private
Converts one class into another.
-
#boolean(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating the value was a boolean.
-
#boolean?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is a Boolean.
- #end_tag ⇒ String private private
-
#escape?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is an escape sequence object (e.g. Escape.).
-
#falsy?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value should be considered false.
- #foreground ⇒ String private private
-
#hash?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is a Hash.
- #initialize(cell, options = {}) ⇒ Vedeu::Cells::HTML constructor private
-
#line_model? ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating the model is a Views::Line.
-
#numeric?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is a Fixnum.
-
#present?(variable) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether a variable has a useful value.
-
#snake_case(klass) ⇒ String
included
from Vedeu::Common
private
Converts a class name to a lowercase snake case string.
- #start_tag ⇒ String private private
-
#stream_model? ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating the model is a Views::Stream.
-
#string?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is a Fixnum.
- #style_attribute ⇒ String private private
- #to_html ⇒ String private
-
#truthy?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value should be considered true.
- #value ⇒ String private private
-
#view_model? ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating the model is a Views::View.
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.
18 19 20 21 |
# File 'lib/vedeu/cells/support/html.rb', line 18 def initialize(cell, = {}) @cell = cell @options = || {} end |
Instance Attribute Details
#cell ⇒ void (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.
This method returns an undefined value.
32 33 34 |
# File 'lib/vedeu/cells/support/html.rb', line 32 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.
36 37 38 |
# File 'lib/vedeu/cells/support/html.rb', line 36 def @options end |
Instance Method Details
#absent?(variable) ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating whether a variable is nil or empty.
#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.
41 42 43 44 45 46 47 48 49 |
# File 'lib/vedeu/cells/support/html.rb', line 41 def background if cell.respond_to?(:background) cell.background.to_html else '' end end |
#become(klass, attributes) ⇒ Class Originally defined in module Vedeu::Common
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.
Converts one class into another.
#boolean(value) ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating the value was a boolean.
#boolean?(value) ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating whether the value is a Boolean.
#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.
52 53 54 |
# File 'lib/vedeu/cells/support/html.rb', line 52 def end_tag .fetch(:end_tag, '</td>') end |
#escape?(value) ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating whether the value is an escape sequence object (e.g. Vedeu::Cells::Escape.)
#falsy?(value) ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating whether the value should be considered false.
#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.
57 58 59 60 61 62 63 64 65 |
# File 'lib/vedeu/cells/support/html.rb', line 57 def foreground if cell.respond_to?(:foreground) cell.foreground.to_html else '' end end |
#hash?(value) ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating whether the value is a Hash.
#line_model? ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating the model is a Views::Line.
#numeric?(value) ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating whether the value is a Fixnum.
#present?(variable) ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating whether a variable has a useful value.
#snake_case(klass) ⇒ String Originally defined in module Vedeu::Common
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.
Converts a class name to a lowercase snake case string.
#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.
68 69 70 |
# File 'lib/vedeu/cells/support/html.rb', line 68 def start_tag .fetch(:start_tag, '<td') end |
#stream_model? ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating the model is a Views::Stream.
#string?(value) ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating whether the value is a Fixnum.
#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.
73 74 75 76 77 78 79 80 81 |
# File 'lib/vedeu/cells/support/html.rb', line 73 def style_attribute if absent?(background) && absent?(foreground) '' else " style='#{background}#{foreground}'" end 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.
24 25 26 |
# File 'lib/vedeu/cells/support/html.rb', line 24 def to_html "#{start_tag}#{style_attribute}>#{value}#{end_tag}" end |
#truthy?(value) ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating whether the value should be considered true.
#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.
84 85 86 87 88 89 90 91 92 |
# File 'lib/vedeu/cells/support/html.rb', line 84 def value if cell.respond_to?(:as_html) && present?(cell.as_html) cell.as_html else ' ' end end |
#view_model? ⇒ Boolean Originally defined in module Vedeu::Common
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.
Returns a boolean indicating the model is a Views::View.