Class: BoundedArray

Inherits:
Array
  • Object
show all
Defined in:
lib/ruby-state-machine/bounded_array.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bounded_sizeObject

Returns the value of attribute bounded_size.



2
3
4
# File 'lib/ruby-state-machine/bounded_array.rb', line 2

def bounded_size
  @bounded_size
end

Instance Method Details

#push(args) ⇒ Object



3
4
5
6
7
# File 'lib/ruby-state-machine/bounded_array.rb', line 3

def push(args)
  super
  @bounded_size ||= 10
  shift until size <= bounded_size
end