Module: Partializer::PathHelper

Included in:
Collection, Partials
Defined in:
lib/partializer/path_helper.rb

Instance Method Summary collapse

Instance Method Details

#build_path(path) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
# File 'lib/partializer/path_helper.rb', line 8

def build_path path
  raise ArgumentError, "Must take a path argument" unless path
  File.join(to_partial_path, path.to_s.gsub('.', '/'))
end

#partial_path(name) ⇒ Object



3
4
5
6
# File 'lib/partializer/path_helper.rb', line 3

def partial_path name
  return File.join(to_partial_path, name.to_s) if partials.include? name.to_sym
  raise Partializer::InvalidPartialError, "the partial #{name} is not registered for this Partializer"
end