Skip to content

Commit

Permalink
Update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
makicamel committed Oct 4, 2021
1 parent 3f8c786 commit ee03982
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/circuit_switch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ def config
@config ||= Configuration.new
end

# @param [Boolean, Proc] if
# @param [Boolean, Proc] close_if
# @param [Boolean] close_if_reach_limit
# @param [Integer] limit_count
# @param if [Boolean, Proc] Call proc when `if` is truthy (default: true)
# @param close_if [Boolean, Proc] Call proc when `close_if` is falsy (default: false)
# @param close_if_reach_limit [Boolean] Stop calling proc when run count reaches limit (default: true)
# @param limit_count [Integer] Limit count. Use `run_limit_count` default value if it's nil
# Can't be set 0 when `close_if_reach_limit` is true (default: nil)
# @param [Proc] block
def run(
if: true,
Expand All @@ -39,10 +40,11 @@ def run(
)
end

# @param [Boolean, Proc] if
# @param [Boolean, Proc] stop_report_if
# @param [Boolean] stop_report_if_reach_limit
# @param [Integer] limit_count
# @param if [Boolean, Proc] Report when `if` is truthy (default: true)
# @param stop_report_if [Boolean, Proc] Report when `close_if` is falsy (default: false)
# @param stop_report_if_reach_limit [Boolean] Stop reporting when reported count reaches limit (default: true)
# @param limit_count [Integer] Limit count. Use `report_limit_count` default value if it's nil
# Can't be set 0 when `stop_report_if_reach_limit` is true (default: nil)
def report(
if: true,
stop_report_if: false,
Expand All @@ -62,8 +64,8 @@ def report(
end

# Syntax sugar for `CircuitSwitch.run`
# @param [Boolean, Proc] if
# @param [Integer] limit_count
# @param if [Boolean, Proc] `CircuitSwitch.run` is runnable when `if` is truthy (default: true)
# @param limit_count [Integer] Limit count. Use `run_limit_count` default value if it's nil. Can't be set 0 (default: nil)
def open?(if: true, limit_count: nil)
if block_given?
raise ArgumentError.new('CircuitSwitch.open doesn\'t receive block. Use CircuitSwitch.run if you want to pass block.')
Expand Down

0 comments on commit ee03982

Please sign in to comment.