Class: Slop::ArrayOption
Overview
Collect multiple items into a single Array. Support arguments separated by commas or multiple occurences.
Constant Summary
Constants inherited from Option
Instance Attribute Summary
Attributes inherited from Option
#block, #config, #count, #desc, #flags, #value
Instance Method Summary collapse
Methods inherited from Option
#ensure_call, #expects_argument?, #finish, #flag, #help?, #initialize, #key, #null?, #reset, #suppress_errors?, #tail, #tail?, #to_s
Constructor Details
This class inherits a constructor from Slop::Option
Instance Method Details
#call(value) ⇒ Object
46 47 48 49 |
# File 'lib/slop/types.rb', line 46 def call(value) @value ||= [] @value.concat value.split(delimiter, limit) end |
#default_value ⇒ Object
51 52 53 |
# File 'lib/slop/types.rb', line 51 def default_value config[:default] || [] end |
#delimiter ⇒ Object
55 56 57 |
# File 'lib/slop/types.rb', line 55 def delimiter config[:delimiter] || "," end |
#limit ⇒ Object
59 60 61 |
# File 'lib/slop/types.rb', line 59 def limit config[:limit] || 0 end |