Sha256: f91b788235e05bea17cac05746850c30426b5da5e1f2fd51d1c187a67196c73a

Contents?: true

Size: 438 Bytes

Versions: 2

Compression:

Stored size: 438 Bytes

Contents

# frozen_string_literal: true

class Array
  # Formats an array into a string suitable for a CAP message.
  #
  # @return [String]
  # @example
  #   [ "one", "two words", "three" ].to_s_for_cap # => "one \"two words\" three"
  # @see String#unpack_cap_list
  def to_s_for_cap
    map { |element| element.to_s.for_cap_list }.join(' ')
  end

  def blank?
    empty?
  end

  def extract_options!
    last.is_a?(Hash) ? pop : {}
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rcap-2.7.4 lib/rcap/extensions/array.rb
rcap-2.7.3 lib/rcap/extensions/array.rb