Class: ActionView::Template::RawFile

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

Overview

Action View RawFile Template

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ RawFile

Returns a new instance of RawFile.



9
10
11
12
13
14
# File 'actionview/lib/action_view/template/raw_file.rb', line 9

def initialize(filename)
  @filename = filename.to_s
  extname = ::File.extname(filename).delete(".")
  @type = Template::Types[extname] || Template::Types[:text]
  @format = @type.symbol
end

Instance Attribute Details

#formatObject

Returns the value of attribute format



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

def format
  @format
end

#typeObject

Returns the value of attribute type



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

def type
  @type
end

Instance Method Details

#identifierObject



16
17
18
# File 'actionview/lib/action_view/template/raw_file.rb', line 16

def identifier
  @filename
end

#render(*args) ⇒ Object



20
21
22
# File 'actionview/lib/action_view/template/raw_file.rb', line 20

def render(*args)
  ::File.read(@filename)
end