class Object
Public Instance Methods
ask(question, answer_type = String, &details)
click to toggle source
# File lib/capistrano_sentinel/patches/capistrano2.rb, line 6 def ask(question, answer_type = String, &details) rake = CapistranoSentinel::RequestHooks.new rake.print_question?(question) do original_ask(question, answer_type, &details) end end
blank?()
click to toggle source
An object is blank if it's false, empty, or a whitespace string. For example, false
, '', ' ', nil
, [], and {} are all blank.
This simplifies
!address || address.empty?
to
address.blank?
@return [true, false]
# File lib/capistrano_sentinel/initializers/active_support/blank.rb, line 14 def blank? respond_to?(:empty?) ? !!empty? : !self end
execute(*args)
click to toggle source
# File lib/capistrano_sentinel/patches/rake.rb, line 6 def execute(*args) rake = CapistranoSentinel::RequestHooks.new(self) rake.automatic_hooks do original_execute(*args) end end
execute_task(task)
click to toggle source
# File lib/capistrano_sentinel/patches/capistrano2.rb, line 17 def execute_task(task) rake = CapistranoSentinel::RequestHooks.new(task) rake.automatic_hooks do original_execute_task(task) end end
presence()
click to toggle source
Returns the receiver if it's present otherwise returns nil
. object.presence
is equivalent to
object.present? ? object : nil
For example, something like
state = params[:state] if params[:state].present? country = params[:country] if params[:country].present? region = state || country || 'US'
becomes
region = params[:state].presence || params[:country].presence || 'US'
@return [Object]
# File lib/capistrano_sentinel/initializers/active_support/blank.rb, line 41 def presence self if present? end
present?()
click to toggle source
An object is present if it's not blank.
@return [true, false]
# File lib/capistrano_sentinel/initializers/active_support/blank.rb, line 21 def present? !blank? end
trigger(event, task = nil)
click to toggle source
# File lib/capistrano_sentinel/patches/capistrano2.rb, line 28 def trigger(event, task = nil) rake = CapistranoSentinel::RequestHooks.new(task) rake.automatic_hooks do original_trigger(event, task) end end