Class: Vedeu::Renderers::File
- Inherits:
-
Object
- Object
- Vedeu::Renderers::File
- Includes:
- Options
- Defined in:
- lib/vedeu/renderers/file.rb
Overview
Writes the given output to a file.
Instance Attribute Summary collapse
- #options ⇒ Hash<Symbol => void> included from Options
Instance Method Summary collapse
-
#absent?(variable) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether a variable is nil or empty.
-
#become(klass, attributes) ⇒ Class
included
from Common
private
Converts one class into another.
-
#boolean(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating the value was a boolean.
-
#boolean?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Boolean.
- #clear ⇒ String
-
#compression ⇒ String
included
from Options
private
Compresses the output depending on configuration.
-
#compression? ⇒ Boolean
included
from Options
private
Returns a boolean indicating whether the content should be compressed if compression is available.
- #content ⇒ String private
- #default_template ⇒ String included from Options private
-
#defaults ⇒ Hash<Symbol => void>
included
from Options
private
The default values for a new instance of this class.
- #end_row_tag ⇒ String included from Options private
- #end_tag ⇒ String included from Options private
-
#escape?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is an escape sequence object (e.g. Cells::Escape.).
-
#falsy?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value should be considered false.
-
#filename ⇒ String
included
from Options
private
Return the filename given in the options, (or use the default), and append a timestamp if the :timestamp option was set to true.
-
#hash?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Hash.
-
#initialize(opts = {}) ⇒ void
included
from Options
Returns a new instance of the class including this module.
-
#line_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::Line.
-
#numeric?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Fixnum.
- #output ⇒ void included from Options private
- #output? ⇒ Boolean included from Options private
-
#present?(variable) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether a variable has a useful value.
- #render(output = '') ⇒ void included from Options
-
#snake_case(klass) ⇒ String
included
from Common
private
Converts a class name to a lowercase snake case string.
- #start_row_tag ⇒ String included from Options private
- #start_tag ⇒ String included from Options private
-
#stream_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::Stream.
-
#string?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Fixnum.
- #template ⇒ String included from Options private
-
#timestamp ⇒ String
included
from Options
private
Return a timestamp for use as part of the filename if the :timestamp option was set to true, otherwise an empty string.
- #timestamp? ⇒ Boolean included from Options private
-
#truthy?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value should be considered true.
-
#view_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::View.
-
#write ⇒ String
Render the output (either content or clearing) to a file.
-
#write_file ⇒ String
included
from Options
private
Render the output (either content or clearing) to a file.
- #write_file? ⇒ Boolean private
Instance Attribute Details
#options ⇒ Hash<Symbol => void> Originally defined in module Options
Instance Method Details
#absent?(variable) ⇒ Boolean Originally defined in module Common
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 boolean indicating whether a variable is nil or empty.
#become(klass, attributes) ⇒ Class Originally defined in module Common
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.
Converts one class into another.
#boolean(value) ⇒ Boolean Originally defined in module Common
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 boolean indicating the value was a boolean.
#boolean?(value) ⇒ Boolean Originally defined in module Common
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 boolean indicating whether the value is a Boolean.
#clear ⇒ String
14 15 16 |
# File 'lib/vedeu/renderers/file.rb', line 14 def clear render('') end |
#compression ⇒ String (private) Originally defined in module Options
Compresses the output depending on configuration.
#compression? ⇒ Boolean (private) Originally defined in module Options
Returns a boolean indicating whether the content should be compressed if compression is available.
#content ⇒ String (private)
32 33 34 |
# File 'lib/vedeu/renderers/file.rb', line 32 def content output end |
#default_template ⇒ String (private) Originally defined in module Options
#defaults ⇒ Hash<Symbol => void> (private) Originally defined in module Options
The default values for a new instance of this class.
#end_row_tag ⇒ String (private) Originally defined in module Options
#end_tag ⇒ String (private) Originally defined in module Options
#escape?(value) ⇒ Boolean Originally defined in module Common
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 boolean indicating whether the value is an escape sequence object (e.g. Vedeu::Cells::Escape.)
#falsy?(value) ⇒ Boolean Originally defined in module Common
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 boolean indicating whether the value should be considered false.
#filename ⇒ String (private) Originally defined in module Options
Return the filename given in the options, (or use the default), and append a timestamp if the :timestamp option was set to true.
#hash?(value) ⇒ Boolean Originally defined in module Common
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 boolean indicating whether the value is a Hash.
#initialize(opts = {}) ⇒ void Originally defined in module Options
Returns a new instance of the class including this module.
#line_model? ⇒ Boolean Originally defined in module Common
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 boolean indicating the model is a Views::Line.
#numeric?(value) ⇒ Boolean Originally defined in module Common
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 boolean indicating whether the value is a Fixnum.
#output ⇒ void (private) Originally defined in module Options
This method returns an undefined value.
#present?(variable) ⇒ Boolean Originally defined in module Common
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 boolean indicating whether a variable has a useful value.
#render(output = '') ⇒ void Originally defined in module Options
This method returns an undefined value.
#snake_case(klass) ⇒ String Originally defined in module Common
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.
Converts a class name to a lowercase snake case string.
#start_row_tag ⇒ String (private) Originally defined in module Options
#start_tag ⇒ String (private) Originally defined in module Options
#stream_model? ⇒ Boolean Originally defined in module Common
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 boolean indicating the model is a Views::Stream.
#string?(value) ⇒ Boolean Originally defined in module Common
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 boolean indicating whether the value is a Fixnum.
#template ⇒ String (private) Originally defined in module Options
#timestamp ⇒ String (private) Originally defined in module Options
Return a timestamp for use as part of the filename if the :timestamp option was set to true, otherwise an empty string.
#truthy?(value) ⇒ Boolean Originally defined in module Common
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 boolean indicating whether the value should be considered true.
#view_model? ⇒ Boolean Originally defined in module Common
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 boolean indicating the model is a Views::View.
#write ⇒ String
Render the output (either content or clearing) to a file.
21 22 23 24 25 26 27 |
# File 'lib/vedeu/renderers/file.rb', line 21 def write data = content ::File.write(filename, data) data end |
#write_file ⇒ String (private) Originally defined in module Options
Render the output (either content or clearing) to a file.
#write_file? ⇒ Boolean (private)
37 38 39 |
# File 'lib/vedeu/renderers/file.rb', line 37 def write_file? true end |