Class: NRSER::RSpex::Opts

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

Instance Method Summary collapse

Methods inherited from Hash

#bury, #bury!, #extract_values_at!, #str_keys, #str_keys!, #sym_keys, #sym_keys!, #to_options, #to_options!, #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



194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/nrser/rspex.rb', line 194

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