Module: Metro::Views::Writers

Extended by:
Writers
Included in:
Writers
Defined in:
lib/metro/views/writers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#default_writerObject

The default view writer, this is the one that will be used if no view can be found by the writers.



33
34
35
# File 'lib/metro/views/writers.rb', line 33

def default_writer
  @default_writer
end

Instance Method Details

#register(writer) ⇒ Object

Register a view writer

A writer is any class or instance that responds to #write(view_path,content), and #format.

Parameters:

  • writer (Writer)

    the writer to add to the list of available writers..



18
19
20
# File 'lib/metro/views/writers.rb', line 18

def register(writer)
  writers.push writer
end

#writersArray<Writers>

Returns an array of all the registered view writers.

Returns:

  • (Array<Writers>)

    an array of all the registered view writers.



25
26
27
# File 'lib/metro/views/writers.rb', line 25

def writers
  @writers ||= []
end