Class: Rubycritic::BaseGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycritic/report_generators/base_generator.rb

Direct Known Subclasses

FileGenerator, IndexGenerator, LineGenerator

Constant Summary collapse

REPORT_DIR =
File.expand_path("tmp/rubycritic", Dir.getwd)
TEMPLATES_DIR =
File.expand_path("../templates", __FILE__)

Instance Method Summary collapse

Instance Method Details

#file_directoryObject

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/rubycritic/report_generators/base_generator.rb', line 15

def file_directory
  raise NotImplementedError.new("You must implement the file_directory method.")
end

#file_hrefObject



7
8
9
# File 'lib/rubycritic/report_generators/base_generator.rb', line 7

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

#file_nameObject

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/rubycritic/report_generators/base_generator.rb', line 19

def file_name
  raise NotImplementedError.new("You must implement the file_name method.")
end

#file_pathnameObject



11
12
13
# File 'lib/rubycritic/report_generators/base_generator.rb', line 11

def file_pathname
  File.join(file_directory, file_name)
end

#get_bindingObject



39
40
41
# File 'lib/rubycritic/report_generators/base_generator.rb', line 39

def get_binding
  binding
end

#index_pathObject



35
36
37
# File 'lib/rubycritic/report_generators/base_generator.rb', line 35

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

#javascript_path(file) ⇒ Object



27
28
29
# File 'lib/rubycritic/report_generators/base_generator.rb', line 27

def javascript_path(file)
  File.join(REPORT_DIR, "assets/javascripts/#{file}.js")
end

#renderObject

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/rubycritic/report_generators/base_generator.rb', line 23

def render
  raise NotImplementedError.new("You must implement the render file_name method.")
end

#stylesheet_path(file) ⇒ Object



31
32
33
# File 'lib/rubycritic/report_generators/base_generator.rb', line 31

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