class Guard::Inch

A guard plugin for the Inch documentation lint tool

Public Class Methods

new(options = {}) click to toggle source

configure a new instance of the plugin @param [Hash] options the guard plugin options

Calls superclass method
# File lib/guard/inch.rb, line 11
def initialize(options = {})
  super
  @options = options
  @all_on_start
  @all_type = options[:all_type] || :none
end

Public Instance Methods

run_all() click to toggle source

Run all of the documentation lints

# File lib/guard/inch.rb, line 28
def run_all
  return unless options[:all_type]
  args = case options[:all_type]
         when :stats
           'stats'
         when :list
           'list'
         when :suggest
           'suggest'
         end
  args << ' .'
  run_inch args
end
run_on_changes(paths) click to toggle source

Run the lints for changes files @param [Array<String>] paths the paths of changed files

# File lib/guard/inch.rb, line 44
def run_on_changes(paths)
  flags = ''
  flags << '--pedantic ' if options[:pedantic]
  flags << '--private ' if options[:private]
  run_inch "#{flags} #{paths.join(' ')}"
end
start() click to toggle source

On start, display a message and optionally run the documentation lint

# File lib/guard/inch.rb, line 19
def start
  message = 'Guard::Inch is running'
  message << ' in pedantic mode' if options[:pedantic]
  message << ' and inspecting private fields' if options[:private]
  ::Guard::UI.info message
  run_all if options[:all_on_start]
end

Private Instance Methods

run_inch(arg_string) click to toggle source

run the inch tool with the specified argument string

# File lib/guard/inch.rb, line 54
def run_inch(arg_string)
  puts `inch #{arg_string}`
end