Class: Grably::ErbJob
Overview
:nodoc:
Defined Under Namespace
Classes: ErbBinder
Instance Method Summary collapse
- #basename(file, ext = nil) ⇒ Object
- #dump(content, io) ⇒ Object
- #read(src) ⇒ Object
- #setup(template:, context:) ⇒ Object
Methods inherited from TextJob
Methods included from Job
Instance Method Details
#basename(file, ext = nil) ⇒ Object
35 36 37 38 |
# File 'lib/grably/jobs/text/erb.rb', line 35 def basename(file, ext = nil) file = file.src if file.is_a? Product File.basename(file, ext) end |
#dump(content, io) ⇒ Object
26 27 28 |
# File 'lib/grably/jobs/text/erb.rb', line 26 def dump(content, io) io << ErbBinder.new(context).eval(content) end |
#read(src) ⇒ Object
30 31 32 33 |
# File 'lib/grably/jobs/text/erb.rb', line 30 def read(src) src = src.src if src.is_a?(Product) IO.read(src) end |
#setup(template:, context:) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/grably/jobs/text/erb.rb', line 19 def setup(template:, context:) @template = template @content = read(template) @filename = basename(template, '.erb') @context = context end |