Class: Structish::Array
- Includes:
- Validations
- Defined in:
- lib/structish/array.rb
Instance Method Summary collapse
- #<<(entry) ⇒ Object
-
#initialize(constructor) ⇒ Array
constructor
A new instance of Array.
Methods included from Validations
Methods inherited from Array
Constructor Details
#initialize(constructor) ⇒ Array
Returns a new instance of Array.
6 7 8 9 10 11 12 13 14 |
# File 'lib/structish/array.rb', line 6 def initialize(constructor) raise(ArgumentError, "Only array-like objects can be used as constructors for Structish::Array") unless constructor.class <= ::Array validate_structish(constructor) if self.class.compact? super(constructor.compact) else super(constructor) end end |
Instance Method Details
#<<(entry) ⇒ Object
16 17 18 19 |
# File 'lib/structish/array.rb', line 16 def <<(entry) super(entry) validate_structish(self) end |