Class: Vedeu::Borders::Refresh Private
- Inherits:
-
Object
- Object
- Vedeu::Borders::Refresh
- Extended by:
- Forwardable
- Includes:
- Common
- Defined in:
- lib/vedeu/borders/refresh.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.
Renders and refreshes the named border.
Instance Attribute Summary collapse
-
#name ⇒ NilClass|Symbol|String
readonly
protected
private
The name of the model, the target model or the name of the associated model.
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Hash<Symbol => void> private private
-
#border ⇒ Vedeu::Borders::Border
private
private
Returns the named border from the borders repository.
-
#bottom ⇒ String
private
private
Renders the bottom border for the interface.
- #bottom_border ⇒ Array<void> private private
-
#build_collection(size, &block) ⇒ Array<void>
private
private
Build a collection with the given size of objects given within the block.
- #by_name ⇒ Array<Array<Vedeu::Cells::Char>> (also: #render) private
-
#captionbar ⇒ Object
private
private
An optional caption for when the bottom border is to be shown.
-
#geometry ⇒ Vedeu::Geometries::Geometry
private
private
Returns the named geometry from the geometries repository.
-
#initialize(name = Vedeu.focus) ⇒ Vedeu::Borders::Refresh
constructor
private
Returns a new instance of Vedeu::Borders::Refresh.
-
#interface ⇒ Vedeu::Interfaces::Interface
(also: #parent)
private
private
Returns the interface by name.
-
#left ⇒ Array<void>
private
private
Renders the left border for the interface.
- #output ⇒ Array<Array<Vedeu::Cells::Char>> private private
-
#right ⇒ Array<void>
private
private
Renders the right border for the interface.
-
#titlebar ⇒ Array<Vedeu::Cells::Horizontal|Vedeu::Cells::Char>
private
private
An optional title for when the top border is to be shown.
-
#top ⇒ String
private
private
Renders the top border for the interface.
- #top_border ⇒ Array<void> 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(name = Vedeu.focus) ⇒ Vedeu::Borders::Refresh
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 new instance of Vedeu::Borders::Refresh.
67 68 69 |
# File 'lib/vedeu/borders/refresh.rb', line 67 def initialize(name = Vedeu.focus) @name = present?(name) ? name : Vedeu.focus end |
Instance Attribute Details
#name ⇒ NilClass|Symbol|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.
Returns The name of the model, the target model or the name of the associated model.
81 82 83 |
# File 'lib/vedeu/borders/refresh.rb', line 81 def name @name end |
Class Method Details
.by_name(name = Vedeu.focus) ⇒ Array<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.
57 58 59 60 61 |
# File 'lib/vedeu/borders/refresh.rb', line 57 def self.by_name(name = Vedeu.focus) name || Vedeu.focus new(name).by_name end |
Instance Method Details
#attributes ⇒ 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.
86 87 88 89 90 91 92 |
# File 'lib/vedeu/borders/refresh.rb', line 86 def attributes { colour: colour, name: name, style: style, } end |
#border ⇒ Vedeu::Borders::Border (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.
Returns the named border from the borders repository.
95 96 97 |
# File 'lib/vedeu/borders/refresh.rb', line 95 def border @border ||= Vedeu.borders.by_name(name) end |
#bottom ⇒ 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.
If a caption has been specified, then the bottom border will include this caption unless the size of the interface is smaller than the padded caption length.
Renders the bottom border for the interface.
119 120 121 |
# File 'lib/vedeu/borders/refresh.rb', line 119 def bottom [(bottom_left if left?), , (bottom_right if right?)].compact end |
#bottom_border ⇒ Array<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.
124 125 126 127 128 |
# File 'lib/vedeu/borders/refresh.rb', line 124 def bottom_border build_collection(bordered_width) do |ix| bottom_horizontal.dup.tap { |cell| cell.position = [yn, bx + ix] } end end |
#build_collection(size, &block) ⇒ Array<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.
Build a collection with the given size of objects given within the block.
207 208 209 |
# File 'lib/vedeu/borders/refresh.rb', line 207 def build_collection(size, &block) Array.new(size) { |e| yield(e) } end |
#by_name ⇒ Array<Array<Vedeu::Cells::Char>> Also known as: render
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/borders/refresh.rb', line 72 def by_name Vedeu.render_output(output) if enabled? && visible? end |
#captionbar ⇒ Object (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.
An optional caption for when the bottom border is to be shown.
186 187 188 189 190 |
# File 'lib/vedeu/borders/refresh.rb', line 186 def return bottom_border unless present?() Vedeu::Borders::Caption.render(name, , bottom_border) end |
#geometry ⇒ Vedeu::Geometries::Geometry (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.
Returns the named geometry from the geometries repository.
131 132 133 |
# File 'lib/vedeu/borders/refresh.rb', line 131 def geometry Vedeu.geometries.by_name(name) end |
#interface ⇒ Vedeu::Interfaces::Interface (private) Also known as: parent
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.
The parent of a border is always an interface.
Returns the interface by name.
Returns the named interface/view from the interfaces repository.
141 142 143 |
# File 'lib/vedeu/borders/refresh.rb', line 141 def interface @_interface ||= Vedeu.interfaces.by_name(name) end |
#left ⇒ Array<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.
Renders the left border for the interface.
149 150 151 152 153 |
# File 'lib/vedeu/borders/refresh.rb', line 149 def left build_collection(bordered_height) do |iy| left_vertical.dup.tap { |cell| cell.position = [by + iy, x] } end end |
#output ⇒ Array<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.
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/vedeu/borders/refresh.rb', line 100 def output Vedeu.timer("Drawing border: '#{name}'") do [ (top if top?), (left if left?), (right if right?), (bottom if bottom?), ].flatten end end |
#right ⇒ Array<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.
Renders the right border for the interface.
158 159 160 161 162 |
# File 'lib/vedeu/borders/refresh.rb', line 158 def right build_collection(bordered_height) do |iy| right_vertical.dup.tap { |cell| cell.position = [by + iy, xn] } end end |
#titlebar ⇒ Array<Vedeu::Cells::Horizontal|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.
An optional title for when the top border is to be shown.
195 196 197 198 199 |
# File 'lib/vedeu/borders/refresh.rb', line 195 def return top_border unless present?(title) Vedeu::Borders::Title.render(name, title, top_border) end |
#top ⇒ 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.
If a title has been specified, then the top border will include this title unless the size of the interface is smaller than the padded title length.
Renders the top border for the interface.
172 173 174 |
# File 'lib/vedeu/borders/refresh.rb', line 172 def top [(top_left if left?), , (top_right if right?)].compact end |
#top_border ⇒ Array<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.
177 178 179 180 181 |
# File 'lib/vedeu/borders/refresh.rb', line 177 def top_border build_collection(bordered_width) do |ix| top_horizontal.dup.tap { |cell| cell.position = [y, bx + ix] } end end |