Class: Vedeu::Views::Line Private
- Inherits:
-
Object
- Object
- Vedeu::Views::Line
- Extended by:
- Forwardable
- Includes:
- Presentation, Presentation::Colour, Presentation::Parent, Presentation::Position, Presentation::Styles, Repositories::Model, DefaultAttributes, Value
- Defined in:
- lib/vedeu/views/line.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.
Represents a single row of the terminal. It is a container for Stream objects. A line’s width is determined by the Geometries::Geometry it belongs to.
Defined Under Namespace
Classes: DSL
Instance Attribute Summary
Attributes included from Repositories::Model
Attributes included from DefaultAttributes
#align, #pad, #truncate, #width, #wordwrap
Instance Method Summary collapse
-
#chars ⇒ Array
private
Returns an array of all the characters with formatting for this line.
-
#eql?(other) ⇒ Boolean
(also: #==)
private
An object is equal when its values are the same.
-
#initialize(attributes = {}) ⇒ Vedeu::Views::Line
constructor
private
Returns a new instance of Vedeu::Views::Line.
-
#size ⇒ Fixnum
private
Returns the size of the content in characters without formatting.
Methods included from Value
Methods included from Presentation::Styles
#render_style, #style, #style=, #style?
Methods included from Presentation::Parent
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?
Methods included from Presentation::Position
#position, #position=, #position?, #render_position, #x, #y
Methods included from Presentation::Colour
#background, #background=, #colour, #colour=, #colour?, #foreground, #foreground=, #interface, #named_colour, #named_colour?, #parent_colour, #parent_colour?, #render_colour
Methods included from Presentation
Methods included from Repositories::Model
Methods included from DefaultAttributes
Methods included from Repositories::Defaults
Constructor Details
#initialize(attributes = {}) ⇒ Vedeu::Views::Line
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::Views::Line.
59 60 61 62 63 |
# File 'lib/vedeu/views/line.rb', line 59 def initialize(attributes = {}) defaults.merge!(attributes).each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Method Details
#chars ⇒ Array
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 an array of all the characters with formatting for this line.
70 71 72 73 74 |
# File 'lib/vedeu/views/line.rb', line 70 def chars return [] unless streams? @chars ||= streams.flat_map(&:chars) end |
#eql?(other) ⇒ Boolean Also known as: ==
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 object is equal when its values are the same.
80 81 82 |
# File 'lib/vedeu/views/line.rb', line 80 def eql?(other) self.class.equal?(other.class) && value == other.value end |
#size ⇒ Fixnum
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 size of the content in characters without formatting.
89 90 91 |
# File 'lib/vedeu/views/line.rb', line 89 def size streams.map(&:size).inject(0, :+) end |