Class: Cutaneous::FileLoader::TemplateReader
- Inherits:
-
Object
- Object
- Cutaneous::FileLoader::TemplateReader
- Defined in:
- lib/cutaneous/loader.rb
Overview
An IO-like interface that provides #read and #path methods
Instance Method Summary collapse
-
#initialize(path, encoding) ⇒ TemplateReader
constructor
A new instance of TemplateReader.
- #path ⇒ Object
- #read(*args) ⇒ Object
Constructor Details
#initialize(path, encoding) ⇒ TemplateReader
62 63 64 65 |
# File 'lib/cutaneous/loader.rb', line 62 def initialize(path, encoding) @path = path @encoding = encoding end |
Instance Method Details
#path ⇒ Object
71 72 73 |
# File 'lib/cutaneous/loader.rb', line 71 def path @path end |
#read(*args) ⇒ Object
67 68 69 |
# File 'lib/cutaneous/loader.rb', line 67 def read(*args) ::File.open(@path, 'r', external_encoding: @encoding) { |f| f.read } end |