module CapistranoSentinel::ApplicationHelper
class that holds the options that are configurable for this gem
Public Instance Methods
get_question_details(data)
click to toggle source
# File lib/capistrano_sentinel/helpers/application_helper.rb, line 36 def get_question_details(data) matches = /(.*)\?*\s*\:*\s*(\([^)]*\))*/m.match(data).captures [matches[0], matches[1]] end
message_from_bundler?(message)
click to toggle source
# File lib/capistrano_sentinel/helpers/application_helper.rb, line 32 def message_from_bundler?(message) message.present? && message.is_a?(Hash) && message['action'].present? && message['job_id'].present? && message['task'].present? && message['action'] == 'bundle_install' end
message_is_about_a_task?(message)
click to toggle source
# File lib/capistrano_sentinel/helpers/application_helper.rb, line 28 def message_is_about_a_task?(message) message.present? && message.is_a?(Hash) && message['action'].present? && message['job_id'].present? && message['task'].present? && message['action'] == 'invoke' end
message_is_for_stdout?(message)
click to toggle source
# File lib/capistrano_sentinel/helpers/application_helper.rb, line 24 def message_is_for_stdout?(message) message.present? && message.is_a?(Hash) && message['action'].present? && message['job_id'].present? && message['action'] == 'stdout' end
msg_for_stdin?(message)
click to toggle source
# File lib/capistrano_sentinel/helpers/application_helper.rb, line 20 def msg_for_stdin?(message) message['action'] == 'stdin' end
parse_json(res)
click to toggle source
Method that is used to parse a string as JSON , if it fails will return nil @see JSON#parse @param [string] res The string that will be parsed as JSON @return [Hash, nil] Returns Hash
object if the json parse succeeds or nil otherwise
# File lib/capistrano_sentinel/helpers/application_helper.rb, line 12 def parse_json(res) return if res.blank? JSON.parse(res) rescue JSON::ParserError nil end