Sha256: 85157e5d7a4a405bef349ff699e3a78e266c8b7534cfc92de6bdb97927262206

Contents?: true

Size: 591 Bytes

Versions: 20

Compression:

Stored size: 591 Bytes

Contents

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

20 entries across 20 versions & 2 rubygems

Version Path
ftpd-1.1.1 features/support/test_file_templates.rb
ftpd-1.1.0 features/support/test_file_templates.rb
investtools-ftpd-1.0.1 features/support/test_file_templates.rb
ftpd-1.0.1 features/support/test_file_templates.rb
ftpd-1.0.0 features/support/test_file_templates.rb
ftpd-0.17.0 features/support/test_file_templates.rb
ftpd-0.16.0 features/support/test_file_templates.rb
ftpd-0.15.0 features/support/test_file_templates.rb
ftpd-0.14.0 features/support/test_file_templates.rb
ftpd-0.13.0 features/support/test_file_templates.rb
ftpd-0.12.0 features/support/test_file_templates.rb
ftpd-0.11.0 features/support/test_file_templates.rb
ftpd-0.10.0 features/support/test_file_templates.rb
ftpd-0.9.0 features/support/test_file_templates.rb
ftpd-0.7.1 features/support/test_file_templates.rb
ftpd-0.8.0 features/support/test_file_templates.rb
ftpd-0.7.0 features/support/test_file_templates.rb
ftpd-0.6.0 features/support/test_file_templates.rb
ftpd-0.5.0 features/support/test_file_templates.rb
ftpd-0.4.0 features/support/test_file_templates.rb