Class: Vedeu::Renderers::File

Inherits:
Object
  • Object
show all
Includes:
Options
Defined in:
lib/vedeu/renderers/support/file.rb

Overview

Writes the given output to a file.

Direct Known Subclasses

Escape, HTML, JSON, Text

Instance Attribute Summary

Attributes included from Options

#options

Instance Method Summary collapse

Methods included from Options

#clear, #compression, #compression?, #default_template, #defaults, #end_row_tag, #end_tag, #filename, #initialize, #output, #output?, #render, #start_row_tag, #start_tag, #template, #timestamp, #timestamp?, #write_file

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?

Instance Method Details

#contentString (private)

Returns:

  • (String)


27
28
29
# File 'lib/vedeu/renderers/support/file.rb', line 27

def content
  output
end

#writeString

Render the output (either content or clearing) to a file.

Returns:

  • (String)


16
17
18
19
20
21
22
# File 'lib/vedeu/renderers/support/file.rb', line 16

def write
  data = content

  ::File.write(filename, data)

  data
end

#write_file?Boolean (private)

Returns:



32
33
34
# File 'lib/vedeu/renderers/support/file.rb', line 32

def write_file?
  true
end