Parent

Class/Module Index [+]

Quicksearch

Reek::Source::CodeComment

A comment header from an abstract syntax tree; found directly above module, class and method definitions.

Constants

CONFIG_REGEX

Public Class Methods

new(text) click to toggle source
# File lib/reek/source/code_comment.rb, line 12
def initialize(text)
  @config =  Hash.new { |hash,key| hash[key] = {} }
  @text = text.gsub(CONFIG_REGEX) do |m|
    add_to_config($1, $2)
    ''
  end.gsub(/#/, '').gsub(/\n/, '').strip
end

Public Instance Methods

config() click to toggle source
# File lib/reek/source/code_comment.rb, line 20
def config
  @config
end
is_descriptive?() click to toggle source
# File lib/reek/source/code_comment.rb, line 24
def is_descriptive?
  @text.split(/\s+/).length >= 2
end

Protected Instance Methods

add_to_config(smell, options) click to toggle source
# File lib/reek/source/code_comment.rb, line 29
def add_to_config(smell, options)
  options ||= ': { enabled: false }'
  @config.merge! YAML.load(smell.gsub(/(?:^|_)(.)/) { $1.upcase } + options)
  # extend this to all configs --------------------------^
  # extend to allow configuration of whole smell class, not just subclass
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.