Class: Vedeu::Output::Output
- Inherits:
-
Object
- Object
- Vedeu::Output::Output
show all
- Includes:
- Common
- Defined in:
- lib/vedeu/output/output.rb
Overview
Sends the output to the renderers.
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
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
Return a new instance of Vedeu::Output::Output.
49
50
51
|
# File 'lib/vedeu/output/output.rb', line 49
def initialize(output)
@output = output
end
|
Instance Attribute Details
93
94
95
|
# File 'lib/vedeu/output/output.rb', line 93
def output
@output
end
|
Class Method Details
.buffer_update(output) ⇒ Array<String>|String|NilClass
19
20
21
|
# File 'lib/vedeu/output/output.rb', line 19
def buffer_update(output)
new(output).buffer_update
end
|
.buffer_write(output) ⇒ Array<String>|String|NilClass
25
26
27
|
# File 'lib/vedeu/output/output.rb', line 25
def buffer_write(output)
new(output).buffer_write
end
|
.direct_write(output) ⇒ Array<String>|String|NilClass
31
32
33
|
# File 'lib/vedeu/output/output.rb', line 31
def direct_write(output)
new(output).direct_write
end
|
.render_output(output) ⇒ Array<String>|String|NilClass
39
40
41
|
# File 'lib/vedeu/output/output.rb', line 39
def render_output(output)
new(output).render_output
end
|
Instance Method Details
#buffer_update ⇒ Array<String>|String|NilClass
#buffer_write ⇒ Array<String>|String|NilClass
#direct_write ⇒ Array<String>|String|NilClass
64
65
66
|
# File 'lib/vedeu/output/output.rb', line 64
def direct_write
Vedeu::Terminal.output(output.to_s) if output?
end
|
98
99
100
|
# File 'lib/vedeu/output/output.rb', line 98
def output?
present?(output)
end
|
#render_output ⇒ Array<String>|String|NilClass
Send the view to the renderers. If the output is a Cells::Escape object (typical when showing or hiding the cursor) then we bypass the Buffers::Terminal and write directly to the terminal because escape sequences only make sense to the terminal and not other renderers.
78
79
80
81
82
83
84
85
86
|
# File 'lib/vedeu/output/output.rb', line 78
def render_output
if escape?(output)
direct_write
else
buffer_write
end
end
|