Class: Raw::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/raw/dispatcher/format.rb

Overview

A REST Resource Representation format.

Direct Known Subclasses

ATOMFormat, HTMLFormat, JSONFormat, RSSFormat, XOXOFormat

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#content_typeObject Also known as: mime_type

The resource content type. Typically the resource MIME type is used.



14
15
16
# File 'lib/raw/dispatcher/format.rb', line 14

def content_type
  @content_type
end

#extensionObject

The default resource extension.



19
20
21
# File 'lib/raw/dispatcher/format.rb', line 19

def extension
  @extension
end

#nameObject

The name of this format.



9
10
11
# File 'lib/raw/dispatcher/format.rb', line 9

def name
  @name
end

#template_extensionObject

The default template extension.



23
24
25
# File 'lib/raw/dispatcher/format.rb', line 23

def template_extension
  @template_extension
end

Instance Method Details

#after_action(controller, context) ⇒ Object

This callback is called after the action is executed with this format.



46
47
# File 'lib/raw/dispatcher/format.rb', line 46

def after_action(controller, context)
end

#before_action(controller, context) ⇒ Object

This callback is called before the action is executed with this format.



40
41
# File 'lib/raw/dispatcher/format.rb', line 40

def before_action(controller, context)
end

#filter_template(source) ⇒ Object

Apply filters to the template source. The original template representation must be transformed to executable Ruby code at the end.



33
34
35
# File 'lib/raw/dispatcher/format.rb', line 33

def filter_template(source)
  return source
end

#to_sObject



25
26
27
# File 'lib/raw/dispatcher/format.rb', line 25

def to_s
  @name
end