Sha256: 9f67aa8bc4e13ecddfa3fe898e11549735ae933222fd123e5695df554ad08ef4

Contents?: true

Size: 1.05 KB

Versions: 13

Compression:

Stored size: 1.05 KB

Contents

module RR

  # Shared functionality for SyncHelper and LogHelper
  module LogHelper

    # Takes outcome and details and makes them fit (for available space) in the
    # 'descrition' and 'long_description' columns of the event log.
    # Parameters:
    # * outcome: short description
    # * details: long description
    # Returns (cut off if necessary)
    # * outcome
    # * details (also containig the full outcome if it had to be cut off for short description)
    def fit_description_columns(outcome, details)
      outcome = outcome.to_s
      if outcome.length > ReplicationInitializer::DESCRIPTION_SIZE
        fitting_outcome = outcome[0...ReplicationInitializer::DESCRIPTION_SIZE]
        fitting_details = outcome + "\n"
      else
        fitting_outcome = outcome
        fitting_details = ""
      end
      fitting_details += details if details
      fitting_details = fitting_details[0...ReplicationInitializer::LONG_DESCRIPTION_SIZE]
      fitting_details = nil if fitting_details.empty?

      return fitting_outcome, fitting_details
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
rubyrep-2.0.1 lib/rubyrep/log_helper.rb
rubyrep-2.0.0 lib/rubyrep/log_helper.rb
andyjeffries-rubyrep-1.2.1 lib/rubyrep/log_helper.rb
rubyrep-1.2.0 lib/rubyrep/log_helper.rb
rubyrep-1.1.2 lib/rubyrep/log_helper.rb
rubyrep-1.1.1 lib/rubyrep/log_helper.rb
rubyrep-1.1.0 lib/rubyrep/log_helper.rb
rubyrep-1.0.9 lib/rubyrep/log_helper.rb
rubyrep-1.0.8 lib/rubyrep/log_helper.rb
rubyrep-1.0.4 lib/rubyrep/log_helper.rb
rubyrep-1.0.5 lib/rubyrep/log_helper.rb
rubyrep-1.0.6 lib/rubyrep/log_helper.rb
rubyrep-1.0.7 lib/rubyrep/log_helper.rb