class Dpl::Examples
Public Instance Methods
Source
# File lib/dpl/provider/examples.rb, line 5 def cmds examples.map(&:cmd).join("\n") end
Source
# File lib/dpl/provider/examples.rb, line 13 def configs examples.map(&:config) end
Source
# File lib/dpl/provider/examples.rb, line 67 def example(opts) return unless opts.any? opts = required_opts.concat(opts).uniq.compact Example.new(const, opts) end
Source
# File lib/dpl/provider/examples.rb, line 17 def examples [requireds, required, many].flatten.compact.uniq end
Source
# File lib/dpl/provider/examples.rb, line 46 def filter(opts) opts = opts.reject(&:internal?) opts.reject { |opt| opt.name == :help } end
Source
# File lib/dpl/provider/examples.rb, line 40 def full opts = const.opts.opts opts = filter(opts) example(opts) end
Source
# File lib/dpl/provider/examples.rb, line 30 def many opts = const.opts.opts opts = order(opts) opts = without_required(opts) opts = with_required(opts) opts = filter(opts) opts = opts[0, 5] example(opts) end
Source
# File lib/dpl/provider/examples.rb, line 51 def order(opts) cmmn = const.superclass.opts.opts opts - cmmn + cmmn end
Source
# File lib/dpl/provider/examples.rb, line 25 def required opts = required_opts example(opts) end
Source
# File lib/dpl/provider/examples.rb, line 79 def required_opts const.opts.select(&:required?) end
Source
# File lib/dpl/provider/examples.rb, line 21 def requireds requireds_opts.map { |opts| example(opts) } end
Source
# File lib/dpl/provider/examples.rb, line 74 def requireds_opts opts = const.required.flatten(1) opts.map { |keys| Array(keys).map { |key| const.opts[key] } } end
Source
# File lib/dpl/provider/examples.rb, line 56 def with_required(opts) requireds = requireds_opts.first || [] opts = requireds + required_opts + opts opts.uniq end
Source
# File lib/dpl/provider/examples.rb, line 62 def without_required(opts) opts -= const.required.flatten.map { |key| const.opts[key] } opts - required_opts.map(&:opts) end