Module: Boson::OptionParser::Viewable

Included in:
Boson::OptionParser
Defined in:
lib/boson/viewable.rb

Instance Method Summary collapse

Instance Method Details

#default_render_optionsObject

:nodoc:



36
37
38
39
# File 'lib/boson/viewable.rb', line 36

def default_render_options #:nodoc:
  {:header_filter=>:capitalize, :description=>false, :filter_any=>true,
    :filter_classes=>{Array=>[:join, ',']}, :hide_empty=>true}
end

#get_fields_and_options(fields, options) ⇒ Object



29
30
31
32
33
34
# File 'lib/boson/viewable.rb', line 29

def get_fields_and_options(fields, options)
  (fields << :default).uniq! if options.delete(:local) || options[:fields] == '*'
  fields, opts = super(fields, options)
  fields.delete(:default) if fields.include?(:default) && opts.all? {|e| e[:default].nil? }
  [fields, opts]
end

#render_table(fields, arr, options) ⇒ Object



41
42
43
44
# File 'lib/boson/viewable.rb', line 41

def render_table(fields, arr, options)
  options = default_render_options.merge(:fields=>fields).merge(options)
  View.render arr, options
end