Class: Vedeu::Output::Write Private
- Inherits:
-
Object
- Object
- Vedeu::Output::Write
- Defined in:
- lib/vedeu/output/write.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.
Directly write to the terminal.
Instance Attribute Summary collapse
- #output ⇒ String readonly private private
Class Method Summary collapse
Instance Method Summary collapse
-
#defaults ⇒ Hash<Symbol => void>
private
private
The default options/attributes for a new instance of this class.
-
#initialize(output = nil, options = {}) ⇒ Vedeu::Output::Write
constructor
private
Returns a new instance of Vedeu::Output::Write.
- #options ⇒ Hash<Symbol => Fixnum> (also: #attributes) private private
- #parent ⇒ NilClass private
- #position(pos = position_start) ⇒ NilClass|Vedeu::Geometries::Position private
- #position_end ⇒ Hash<Symbol => Fixnum> private private
- #position_start ⇒ Hash<Symbol => Fixnum> private private
- #to_s ⇒ String (also: #to_str) private private
- #value ⇒ String protected private
- #write ⇒ Array<String> private
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?, #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
Constructor Details
#initialize(output = nil, options = {}) ⇒ Vedeu::Output::Write
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::Output::Write.
37 38 39 40 41 42 |
# File 'lib/vedeu/output/write.rb', line 37 def initialize(output = nil, = {}) @output = output @options = @colour = [:colour] @style = [:style] end |
Instance Attribute Details
#output ⇒ String (readonly, 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.
65 66 67 |
# File 'lib/vedeu/output/write.rb', line 65 def output @output end |
Class Method Details
.write(output = nil, options = {}) ⇒ Array<String>
24 25 26 |
# File 'lib/vedeu/output/write.rb', line 24 def self.write(output = nil, = {}) new(output, ).write end |
Instance Method Details
#defaults ⇒ 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.
The default options/attributes for a new instance of this class.
71 72 73 74 75 76 |
# File 'lib/vedeu/output/write.rb', line 71 def defaults { x: 1, y: 1, } end |
#options ⇒ Hash<Symbol => Fixnum> (private) Also known as: attributes
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.
79 80 81 |
# File 'lib/vedeu/output/write.rb', line 79 def defaults.merge!(@options) end |
#parent ⇒ NilClass
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.
45 46 47 |
# File 'lib/vedeu/output/write.rb', line 45 def parent nil end |
#position(pos = position_start) ⇒ NilClass|Vedeu::Geometries::Position
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/output/write.rb', line 50 def position(pos = position_start) Vedeu::Geometries::Position.coerce(pos) end |
#position_end ⇒ Hash<Symbol => Fixnum> (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.
98 99 100 101 102 103 |
# File 'lib/vedeu/output/write.rb', line 98 def position_end { x: [:x] + output.size, y: [:y], } end |
#position_start ⇒ Hash<Symbol => Fixnum> (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.
90 91 92 93 94 95 |
# File 'lib/vedeu/output/write.rb', line 90 def position_start { x: [:x], y: [:y], } end |
#to_s ⇒ String (private) Also known as: to_str
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.
106 107 108 |
# File 'lib/vedeu/output/write.rb', line 106 def to_s @_to_s ||= super + Vedeu.esc.reset + position(position_end) end |
#value ⇒ String (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.
66 67 68 |
# File 'lib/vedeu/output/write.rb', line 66 def output @output end |
#write ⇒ Array<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.
55 56 57 58 59 |
# File 'lib/vedeu/output/write.rb', line 55 def write Vedeu.direct_write(to_s) to_s end |