Class: ActionView::Template::Text

Inherits:
String
  • Object
show all
Defined in:
lib/action_view/template/text.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string, mime_type = nil) ⇒ Text

Returns a new instance of Text


7
8
9
10
11
# File 'lib/action_view/template/text.rb', line 7

def initialize(string, mime_type = nil)
  super(string.to_s)
  @mime_type   = Mime[mime_type] || mime_type if mime_type
  @mime_type ||= Mime::TEXT
end

Instance Attribute Details

#mime_typeObject

Returns the value of attribute mime_type


5
6
7
# File 'lib/action_view/template/text.rb', line 5

def mime_type
  @mime_type
end

Instance Method Details

#formatsObject


25
26
27
# File 'lib/action_view/template/text.rb', line 25

def formats
  [@mime_type.to_sym]
end

#identifierObject


13
14
15
# File 'lib/action_view/template/text.rb', line 13

def identifier
  'text template'
end

#inspectObject


17
18
19
# File 'lib/action_view/template/text.rb', line 17

def inspect
  'text template'
end

#render(*args) ⇒ Object


21
22
23
# File 'lib/action_view/template/text.rb', line 21

def render(*args)
  to_s
end