Class: Vedeu::DSL::Text Private
- Inherits:
-
Object
- Object
- Vedeu::DSL::Text
- Includes:
- Common
- Defined in:
- lib/vedeu/dsl/helpers/text.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.
Manipulates text values based on given options when building views.
Instance Attribute Summary collapse
- #options ⇒ Hash<Symbol => void> readonly protected private
- #value ⇒ NilClass|String readonly protected private
Instance Method Summary collapse
- #align ⇒ String private private
- #align? ⇒ NilClass|Vedeu::Coercers::Alignment private private
- #attributes(char) ⇒ Hash<Symbol => void> private private
- #chars ⇒ Array<Vedeu::Cells::Char> private
- #collection ⇒ Array<Vedeu::Cells::Char> private private
- #initialize(value = '', options = {}) ⇒ Vedeu::DSL::Text constructor private
- #name ⇒ NilClass|String|Symbol private private
- #parent ⇒ NilClass|void private private
- #text ⇒ String private private
- #truncate ⇒ String private private
- #truncate? ⇒ Boolean|NilClass private private
Methods included from 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(value = '', options = {}) ⇒ Vedeu::DSL::Text
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.
19 20 21 22 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 19 def initialize(value = '', = {}) @value = value || '' @options = || {} end |
Instance Attribute Details
#options ⇒ Hash<Symbol => 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.
35 36 37 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 35 def @options end |
#value ⇒ NilClass|String (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.
39 40 41 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 39 def value @value end |
Instance Method Details
#align ⇒ 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.
44 45 46 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 44 def align Vedeu::DSL::Align.new(value, ).text end |
#align? ⇒ NilClass|Vedeu::Coercers::Alignment (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.
49 50 51 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 49 def align? [:align] end |
#attributes(char) ⇒ Hash<Symbol => void> (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 60 61 62 63 64 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 55 def attributes(char) { colour: [:colour], name: name, parent: parent, position: nil, style: [:style], value: char, } end |
#chars ⇒ Array<Vedeu::Cells::Char>
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.
25 26 27 28 29 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 25 def chars return [] unless present?(value) && string?(value) collection end |
#collection ⇒ Array<Vedeu::Cells::Char> (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 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 67 def collection text.chars.map { |char| Vedeu::Cells::Char.new(attributes(char)) } end |
#name ⇒ NilClass|String|Symbol (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.
72 73 74 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 72 def name [:name] end |
#parent ⇒ NilClass|void (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.
77 78 79 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 77 def parent [:parent] end |
#text ⇒ 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.
82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 82 def text if truncate? truncate elsif align? align else value end end |
#truncate ⇒ 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.
96 97 98 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 96 def truncate Vedeu::DSL::Truncate.new(value, ).text end |
#truncate? ⇒ Boolean|NilClass (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.
101 102 103 |
# File 'lib/vedeu/dsl/helpers/text.rb', line 101 def truncate? [:truncate] end |