Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/shapes/core.rb

Overview

Core class extensions Copyright © M.J.N. Corino, The Netherlands

Instance Method Summary collapse

Instance Method Details

#resize(sz, obj = nil, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/wx/shapes/core.rb', line 6

def resize(sz, obj=nil, &block)
  if sz > self.size
    if block
      self.fill(sz-1, 0, &block)
    else
      self.fill(obj, sz-1, 0)
    end
  elsif sz < self.size
    self.slice!(0, sz)
  end
  self
end