Class: Rubycritic::Generator::Html::Base

Inherits:
Object
  • Object
show all
Includes:
ViewHelpers
Defined in:
lib/rubycritic/generators/html/base.rb

Direct Known Subclasses

CodeFile, CodeIndex, Line, Overview, SmellsIndex

Constant Summary collapse

TEMPLATES_DIR =
File.expand_path('../templates', __FILE__)
LAYOUT_TEMPLATE =
erb_template(File.join('layouts', 'application.html.erb'))

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ViewHelpers

#asset_path, #file_path, #javascript_tag, #smell_location_path, #stylesheet_path, #timeago_tag

Class Method Details

.erb_template(template_path) ⇒ Object



9
10
11
# File 'lib/rubycritic/generators/html/base.rb', line 9

def self.erb_template(template_path)
  ERB.new(File.read(File.join(TEMPLATES_DIR, template_path)))
end

Instance Method Details

#file_directoryObject



26
27
28
# File 'lib/rubycritic/generators/html/base.rb', line 26

def file_directory
  @file_directory ||= root_directory
end

#file_hrefObject



18
19
20
# File 'lib/rubycritic/generators/html/base.rb', line 18

def file_href
  "file://#{file_pathname}"
end

#file_nameObject



30
31
32
33
# File 'lib/rubycritic/generators/html/base.rb', line 30

def file_name
  fail NotImplementedError,
       "The #{self.class} class must implement the #{__method__} method."
end

#file_pathnameObject



22
23
24
# File 'lib/rubycritic/generators/html/base.rb', line 22

def file_pathname
  File.join(file_directory, file_name)
end

#renderObject



35
36
37
38
# File 'lib/rubycritic/generators/html/base.rb', line 35

def render
  fail NotImplementedError,
       "The #{self.class} class must implement the #{__method__} method."
end