Class: ActionView::Template::HTML

Inherits:
Object
  • Object
show all
Defined in:
actionview/lib/action_view/template/html.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string, type = nil) ⇒ HTML

Returns a new instance of HTML.



9
10
11
12
13
14
15
16
17
# File 'actionview/lib/action_view/template/html.rb', line 9

def initialize(string, type = nil)
  unless type
    ActiveSupport::Deprecation.warn "ActionView::Template::HTML#initialize requires a type parameter"
    type = :html
  end

  @string = string.to_s
  @type   = type
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type



7
8
9
# File 'actionview/lib/action_view/template/html.rb', line 7

def type
  @type
end

Instance Method Details

#formatObject



33
34
35
# File 'actionview/lib/action_view/template/html.rb', line 33

def format
  @type
end

#formatsObject



37
# File 'actionview/lib/action_view/template/html.rb', line 37

def formats; Array(format); end

#identifierObject Also known as: inspect



19
20
21
# File 'actionview/lib/action_view/template/html.rb', line 19

def identifier
  "html template"
end

#render(*args) ⇒ Object



29
30
31
# File 'actionview/lib/action_view/template/html.rb', line 29

def render(*args)
  to_str
end

#to_strObject



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

def to_str
  ERB::Util.h(@string)
end