module Rubycritic

  module ViewHelpers
    def javascript_path(file)
      asset_path(File.join("javascripts", "#{file}.js"))
    end

    def stylesheet_path(file)
      asset_path(File.join("stylesheets", "#{file}.css"))
    end

    def asset_path(file)
      File.join(root_directory, "assets", file)
    end

    def smell_location_path(location)
      pathname = location.pathname
      File.join(root_directory, "#{pathname.sub_ext('.html')}#L#{location.line}")
    end

    def index_path
      File.join(root_directory, "index.html")
    end
  end

end

module Rubycritic

  module ViewHelpers
    def javascript_path(file)
      asset_path(File.join("javascripts", "#{file}.js"))
    end

    def stylesheet_path(file)
      asset_path(File.join("stylesheets", "#{file}.css"))
    end

    def asset_path(file)
      File.join(root_directory, "assets", file)
    end

    def smell_location_path(location)
      pathname = location.pathname
      File.join(root_directory, "#{pathname.sub_ext('.html')}#L#{location.line}")
    end

    def index_path
      File.join(root_directory, "index.html")
    end

    # Includers must override
    def root_directory
      raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.")
    end
  end

end

Implement abstract `root_directory` method in ViewHelpers
Implement abstract `root_directory` method in ViewHelpers

From Practical Object-Oriented Design In Ruby, page 151, by Sandi Metz:

"Even if there were no reasonable application default for [the foo
method], the [bar] module must still implement the [foo] method. The
rules for modules are the same as for classical inheritance. If a module
sends a message it must provide an implementation, even if that
implementation merely raises an error indicating that users of the
module must implement the method."
