Permalink
Browse files

yard doc fixes [ci skip]

  • Loading branch information...
e2 committed Dec 1, 2014
1 parent f455fc2 commit 280a02c906fe2cfac5f0f7c1d6327fc099ce7d3c
Showing with 41 additions and 44 deletions.
  1. +3 −0 .yardopts
  2. +4 −2 lib/guard.rb
  3. +2 −3 lib/guard/dsl.rb
  4. +5 −6 lib/guard/notifier.rb
  5. +24 −24 lib/guard/notifiers/tmux.rb
  6. +2 −2 lib/guard/plugin.rb
  7. +1 −7 lib/guard/ui.rb
View
@@ -1,4 +1,7 @@
--title 'Guard Documentation'
+--no-private
+--embed-mixin ClassMethods
+--exclude lib/guard/internals
--readme README.md
--markup markdown
--markup-provider redcarpet
View
@@ -86,9 +86,11 @@ def init(cmdline_options)
#
# Currently supported args:
#
- # old style hash: {modified: ['foo'], added: ['bar'], removed: []}
+ # @example Old style hash:
+ # async_queue_add(modified: ['foo'], added: ['bar'], removed: [])
#
- # new style signals with args: [:guard_pause, :unpaused ]
+ # @example New style signals with args:
+ # async_queue_add([:guard_pause, :unpaused ])
#
def async_queue_add(changes)
@queue << changes
View
@@ -227,11 +227,10 @@ def watch(pattern, &action)
# `run_on_additions`, `run_on_modifications` and `run_on_removals` plugin
# method.
#
- # @example Define a callback that'll be called before the `reload` action.
+ # @example Add callback before the `reload` action.
# callback(:reload_begin) { puts "Let's reload!" }
#
- # @example Define a callback that'll be called before the `start` and
- # `stop` actions.
+ # @example Add callback before the `start` and `stop` actions.
#
# my_lambda = lambda do |plugin, event, *args|
# puts "Let's #{event} #{plugin} with #{args}!"
View
@@ -9,8 +9,7 @@
module Guard
# The notifier handles sending messages to different notifiers. Currently the
- # following
- # libraries are supported:
+ # following libraries are supported:
#
# * Ruby GNTP
# * Growl
@@ -109,13 +108,13 @@ def disconnect
# @param [Hash] options the turn_on options
# @option options [Boolean] silent disable any logging
#
- def turn_on(opts = {})
+ def turn_on(options = {})
_check_server!
return unless enabled?
fail "Already active!" if active?
- silent = opts[:silent]
+ silent = options[:silent]
@detected.available.each do |klass, _|
::Guard::UI.info(format(USING_NOTIFIER, klass.title)) unless silent
@@ -171,7 +170,7 @@ def active?
# @option options [String] silent disable any error message
# @return [Boolean] if the notification could be added
#
- def add(name, opts = {})
+ def add(name, options = {})
_check_server!
return false unless enabled?
@@ -182,7 +181,7 @@ def add(name, opts = {})
end
# ok to pass new instance when called without connect (e.g. evaluator)
- (@detected || Detected.new(SUPPORTED)).add(name, opts)
+ (@detected || Detected.new(SUPPORTED)).add(name, options)
end
# TODO: deprecate/remove
@@ -173,41 +173,41 @@ def self.available?(opts = {})
# to true, and may further disable the colorization by setting
# `change_color` to false.
#
- # @param [String] title the notification title
- # @param [Hash] opts additional notification library options
- # @option opts [String] type the notification type. Either 'success',
+ # @param [String] message the notification message
+ # @param [Hash] options additional notification library options
+ # @option options [String] type the notification type. Either 'success',
# 'pending', 'failed' or 'notify'
- # @option opts [String] message the notification message body
- # @option opts [String] image the path to the notification image
- # @option opts [Boolean] change_color whether to show a color
+ # @option options [String] message the notification message body
+ # @option options [String] image the path to the notification image
+ # @option options [Boolean] change_color whether to show a color
# notification
- # @option opts [String,Array] color_location the location where to draw
+ # @option options [String,Array] color_location the location where to draw
# the color notification
- # @option opts [Boolean] display_message whether to display a message
+ # @option options [Boolean] display_message whether to display a message
# or not
- # @option opts [Boolean] display_on_all_clients whether to display a
+ # @option options [Boolean] display_on_all_clients whether to display a
# message on all tmux clients or not
#
- def notify(message, opts = {})
+ def notify(message, options = {})
super
- opts.delete(:image)
+ options.delete(:image)
- change_color = Defaults.option(opts, :change_color)
- options = Array(Defaults.option(opts, :color_location))
- display_the_title = Defaults.option(opts, :display_title)
- display_message = Defaults.option(opts, :display_message)
- type = opts.delete(:type).to_s
- title = opts.delete(:title)
+ change_color = Defaults.option(options, :change_color)
+ locations = Array(Defaults.option(options, :color_location))
+ display_the_title = Defaults.option(options, :display_title)
+ display_message = Defaults.option(options, :display_message)
+ type = options.delete(:type).to_s
+ title = options.delete(:title)
if change_color
- color = tmux_color(type, opts)
- options.each { |location| Client.set(_all?, location, color) }
+ color = tmux_color(type, options)
+ locations.each { |location| Client.set(_all?, location, color) }
end
- display_title(type, title, message, opts) if display_the_title
+ display_title(type, title, message, options) if display_the_title
return unless display_message
- display_message(type, title, message, opts)
+ display_message(type, title, message, options)
end
# Displays a message in the title bar of the terminal.
@@ -224,10 +224,10 @@ def notify(message, opts = {})
# @option options [String] default_message_format a string to use as
# formatter when no format per type is defined.
#
- def display_title(type, title, message, opts = {})
+ def display_title(type, title, message, options = {})
format = "#{type}_title_format".to_sym
- options = Defaults.option(opts, :default_title_format)
- title_format = opts.fetch(format, options)
+ default_title_format = Defaults.option(options, :default_title_format)
+ title_format = options.fetch(format, default_title_format)
teaser_message = message.split("\n").first
display_title = title_format % [title, teaser_message]
View
@@ -91,7 +91,7 @@ def self.reset_callbacks!
# hook :foo
# end
#
- # Here, when {Guard::Plugin::Base#run_all} is called, {#hook} will notify
+ # Here, when {Guard::Plugin#run_all} is called, {#hook} will notify
# callbacks registered for the "run_all_foo" event.
#
# When event is a String, {#hook} will directly turn the String
@@ -103,7 +103,7 @@ def self.reset_callbacks!
# hook "foo_bar"
# end
#
- # When {Guard::Plugin::Base#run_all} is called, {#hook} will notify
+ # When {Guard::Plugin::run_all} is called, {#hook} will notify
# callbacks registered for the "foo_bar" event.
#
# @param [Symbol, String] event the name of the Guard event
View
@@ -185,13 +185,7 @@ def _filter(plugin)
yield plugin
end
- # Display a message of the type `method` and with the color `color_name`
- # (no color by default) conditionnaly given a `plugin_name`.
- #
- # @param [String] plugin_name the calling plugin name
- # @option options [Boolean] reset whether to clean the output before
- # @option options [String] plugin manually define the calling plugin
- #
+ # @private
def _filtered_logger_message(message, method, color_name, options = {})
message = color(message, color_name) if color_name

0 comments on commit 280a02c

Please sign in to comment.