Sha256: ee9ebf3b89fda817c41405d9e93309a5547f4f1fc88cbe0079426b1c14af4c64

Contents?: true

Size: 769 Bytes

Versions: 14

Compression:

Stored size: 769 Bytes

Contents

require 'assert/view/default_view'

module Assert::View

  # this method is used to bring in custom user-specific views
  # require views by passing either a full path to the view ruby file
  # or passing the name of a view installed in ~/.assert/views

  def self.require_user_view(view_name)
    views_file = File.expand_path(
      File.join("#{ENV['HOME']}/.assert/views", view_name, 'lib', view_name)
    )

    if File.exists?(view_name) || File.exists?(view_name + '.rb')
      require view_name
    elsif File.exists?(views_file + '.rb')
      require views_file
    else
      msg = "[WARN] Can't find or require #{view_name.inspect} view."
      msg << " Did you install it in `~/.assert/views`?" if !view_name.match(/\A\//)
      warn msg
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
assert-2.14.0 lib/assert/view.rb
assert-2.13.0 lib/assert/view.rb
assert-2.12.2 lib/assert/view.rb
assert-2.12.1 lib/assert/view.rb
assert-2.12.0 lib/assert/view.rb
assert-2.11.0 lib/assert/view.rb
assert-2.10.1 lib/assert/view.rb
assert-2.10.0 lib/assert/view.rb
assert-2.9.0 lib/assert/view.rb
assert-2.8.0 lib/assert/view.rb
assert-2.7.1 lib/assert/view.rb
assert-2.7.0 lib/assert/view.rb
assert-2.6.0 lib/assert/view.rb
assert-2.5.0 lib/assert/view.rb