Class: NRSER::RSpex::Opts

Inherits:
Hash
  • Object
show all
Defined in:
lib/nrser/rspex.rb

Instance Method Summary collapse

Instance Method Details

#to_desc(max = nil) ⇒ Object



218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/nrser/rspex.rb', line 218

def to_desc max = nil
  return '' if empty?
  
  max = [16, ( 64 / self.count )].max if max.nil?
  
  map { |key, value|
    if key.is_a? Symbol
      "#{ key }: #{ NRSER::RSpex.short_s value, max }"
    else
      "#{ NRSER::RSpex.short_s key, max } => #{ NRSER::RSpex.short_s value, max }"
    end
  }.join( ", " )
end