Sha256: f679cdeab1023d0454e420ddcbe8a3958edba96f0ecece89377b2cfdf231462e
Contents?: true
Size: 622 Bytes
Versions: 2
Compression:
Stored size: 622 Bytes
Contents
# frozen_string_literal: true class TestFileTemplates def [](filename) if have_template?(filename) read_template filename else default_template filename end end private def have_template?(filename) File.exists?(template_path(filename)) end def read_template(filename) File.open(template_path(filename), 'rb', &:read) end def template_path(filename) File.expand_path(filename, templates_path) end def templates_path File.expand_path('file_templates', File.dirname(__FILE__)) end def default_template(filename) "Contents of #{filename}" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ftpd-2.0.1 | features/support/test_file_templates.rb |
ftpd-2.0.0 | features/support/test_file_templates.rb |