Sha256: 10d6a7344479109a7aefc1785a1c1e02fa0b2434325861d8c4a621f06fa261e1

Contents?: true

Size: 542 Bytes

Versions: 14

Compression:

Stored size: 542 Bytes

Contents

class Array 
  
  ##
  # Split _string_ into an array. Used in
  # conjunction with Highline's #ask, or #ask_for_array
  # methods, which must respond to #parse.
  #
  # This method allows escaping of whitespace. For example
  # the arguments foo bar\ baz will become ['foo', 'bar baz']
  #
  # === Example
  #  
  #   # ask invokes Array#parse
  #   list = ask 'Favorite cookies:', Array
  #
  #   # or use ask_for_CLASS
  #   list = ask_for_array 'Favorite cookies: '
  #
  
  def self.parse string
    eval "%w(#{string})"
  end
    
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
crishoj-commander-3.3.0 lib/commander/core_ext/array.rb
ktec-commander-3.3.1 lib/commander/core_ext/array.rb
commander-4.1.2 lib/commander/core_ext/array.rb
commander-4.1.1 lib/commander/core_ext/array.rb
commander-4.1.0 lib/commander/core_ext/array.rb
commander-4.0.7 lib/commander/core_ext/array.rb
commander-4.0.6 lib/commander/core_ext/array.rb
commander-4.0.5 lib/commander/core_ext/array.rb
commander-4.0.4 lib/commander/core_ext/array.rb
commander-4.0.3 lib/commander/core_ext/array.rb
commander-4.0.2 lib/commander/core_ext/array.rb
commander-4.0.1 lib/commander/core_ext/array.rb
commander-4.0.0 lib/commander/core_ext/array.rb
commander-3.3.0 lib/commander/core_ext/array.rb