Class: Cutaneous::FileLoader::TemplateReader

Inherits:
Object
  • Object
show all
Defined in:
lib/cutaneous/loader.rb

Overview

An IO-like interface that provides #read and #path methods

Instance Method Summary collapse

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

#pathObject



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