Class: NRSER::RSpex::Opts

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

Instance Method Summary collapse

Methods inherited from Hash

#bury!, #extract_values_at!, #to_pair, #transform_values_with_keys, #transform_values_with_keys!

Methods included from Ext::Tree

#each_branch, #leaves, #map_branches, #map_leaves, #map_tree

Instance Method Details

#to_desc(max = nil) ⇒ Object



203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/nrser/rspex.rb', line 203

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