Method: Pry::Slop#initialize
- Defined in:
- lib/pry/slop.rb
#initialize(config = {}, &block) ⇒ Slop
Create a new instance of Slop and optionally build options via a block.
config - A Hash of configuration options. block - An optional block used to specify options.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/pry/slop.rb', line 127 def initialize(config = {}, &block) @config = DEFAULT_OPTIONS.merge(config) @options = [] @commands = {} @trash = [] @triggered_options = [] @unknown_options = [] @callbacks = {} @separators = {} @runner = nil if block_given? block.arity == 1 ? yield(self) : instance_eval(&block) end return unless config[:help] on('-h', '--help', 'Display this help message.', tail: true) do warn help end end |