Sha256: 171617e41fd6ec1f0d182e91721cc3bc1ddf39c533bdfad0c255311d8d7e3f4e

Contents?: true

Size: 478 Bytes

Versions: 11

Compression:

Stored size: 478 Bytes

Contents

module TemplateHelpers
  def eval_file(source)
    location = File.expand_path(find_in_source_paths(source))
    unique_name = SecureRandom.hex

    define_singleton_method unique_name do
      instance_eval File.read(location)
    end

    public_send unique_name
  end

  def source_path(path)
    define_singleton_method :source_paths do
      [File.expand_path(File.dirname(path))]
    end
  end

  def erase_comments(file)
    gsub_file file, /^\s*#[^\n]*\n/, ''
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
potassium-1.3.3 lib/potassium/templates/application/helpers/template-helpers.rb
potassium-1.3.2 lib/potassium/templates/application/helpers/template-helpers.rb
potassium-1.3.0 lib/potassium/templates/application/helpers/template-helpers.rb
potassium-1.2.4 lib/potassium/templates/application/helpers/template-helpers.rb
potassium-1.2.3 lib/potassium/templates/application/helpers/template-helpers.rb
potassium-1.2.2 lib/potassium/templates/application/helpers/template-helpers.rb
potassium-1.2.1 lib/potassium/templates/application/helpers/template-helpers.rb
potassium-1.2.0 lib/potassium/templates/application/helpers/template-helpers.rb
potassium-1.1.0 lib/potassium/templates/application/helpers/template-helpers.rb
potassium-1.0.1 lib/potassium/templates/application/helpers/template-helpers.rb
potassium-1.0.0 lib/potassium/templates/application/helpers/template-helpers.rb