Class: ActionView::Template::RawFile
- Inherits:
-
Object
- Object
- ActionView::Template::RawFile
- Defined in:
- lib/action_view/template/raw_file.rb
Overview
Action View RawFile Template
Instance Attribute Summary collapse
-
#format ⇒ Object
:nodoc:.
-
#type ⇒ Object
:nodoc:.
Instance Method Summary collapse
- #identifier ⇒ Object
-
#initialize(filename) ⇒ RawFile
constructor
A new instance of RawFile.
- #render(*args) ⇒ Object
Constructor Details
#initialize(filename) ⇒ RawFile
Returns a new instance of RawFile.
9 10 11 12 13 14 |
# File '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
#format ⇒ Object
:nodoc:
7 8 9 |
# File 'lib/action_view/template/raw_file.rb', line 7 def format @format end |
#type ⇒ Object
:nodoc:
7 8 9 |
# File 'lib/action_view/template/raw_file.rb', line 7 def type @type end |
Instance Method Details
#identifier ⇒ Object
16 17 18 |
# File 'lib/action_view/template/raw_file.rb', line 16 def identifier @filename end |
#render(*args) ⇒ Object
20 21 22 |
# File 'lib/action_view/template/raw_file.rb', line 20 def render(*args) ::File.read(@filename) end |