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



184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/nrser/rspex.rb', line 184

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