Current Path : /usr/local/share/ri/1.8/system/Array/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/local/share/ri/1.8/system/Array/slice-i.yaml |
--- !ruby/object:RI::MethodDescription aliases: [] block_params: comment: - !ruby/struct:SM::Flow::P body: Element Reference---Returns the element at <em>index</em>, or returns a subarray starting at <em>start</em> and continuing for <em>length</em> elements, or returns a subarray specified by <em>range</em>. Negative indices count backward from the end of the array (-1 is the last element). Returns nil if the index (or starting index) are out of range. - !ruby/struct:SM::Flow::VERB body: " a = [ "a", "b", "c", "d", "e" ]\n a[2] + a[0] + a[1] #=> "cab"\n a[6] #=> nil\n a[1, 2] #=> [ "b", "c" ]\n a[1..3] #=> [ "b", "c", "d" ]\n a[4..7] #=> [ "e" ]\n a[6..10] #=> nil\n a[-3, 3] #=> [ "c", "d", "e" ]\n # special cases\n a[5] #=> nil\n a[5, 1] #=> []\n a[5..10] #=> []\n" full_name: Array#slice is_singleton: false name: slice params: | array[index] -> obj or nil array[start, length] -> an_array or nil array[range] -> an_array or nil array.slice(index) -> obj or nil array.slice(start, length) -> an_array or nil array.slice(range) -> an_array or nil visibility: public