Class: Glslkit::Resolvers::Hash
- Inherits:
-
Object
- Object
- Glslkit::Resolvers::Hash
- Defined in:
- lib/glslkit/resolvers/hash.rb
Overview
=> content というフラットなHashを直接引くだけ。ファイル
システムを持たないwasm側ランタイムやテストで使う。fromはインタ
フェースの形を合わせるために受け取るが無視する。ディレクトリ構造が
存在しないため、相対解決のしようがない。
Instance Method Summary collapse
-
#initialize(files) ⇒ Hash
constructor
A new instance of Hash.
- #read(request, from: nil) ⇒ Object
Constructor Details
#initialize(files) ⇒ Hash
Returns a new instance of Hash.
12 13 14 |
# File 'lib/glslkit/resolvers/hash.rb', line 12 def initialize(files) @files = files end |
Instance Method Details
#read(request, from: nil) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/glslkit/resolvers/hash.rb', line 16 def read(request, from: nil) content = @files[request] raise IncludeNotFound, "no such include: #{request.inspect}" unless content [request, content] end |