Class: Vedeu::Views::Lines Private
- Inherits:
-
Repositories::Collection
- Object
- Repositories::Collection
- Vedeu::Views::Lines
- Defined in:
- lib/vedeu/views/lines.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A collection of Line instances.
Class Method Summary collapse
Constructor Details
This class inherits a constructor from Vedeu::Repositories::Collection
Class Method Details
.coerce(collection = [], parent = nil, name = nil) ⇒ Vedeu::Views::Lines
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/vedeu/views/lines.rb', line 16 def self.coerce(collection = [], parent = nil, name = nil) if collection.is_a?(Vedeu::Views::Lines) collection elsif collection.is_a?(Vedeu::Views::Streams) if collection.empty? # @todo Investigate whether this is being used. end elsif collection.is_a?(Array) return new(collection, parent, name) if collection.empty? coerced_collection = [] collection.each do |element| coerced_collection << element if element.is_a?(Vedeu::Views::Line) end new(coerced_collection, parent, name) elsif collection.is_a?(Vedeu::Views::Line) new([collection], parent, name) else fail Vedeu::Error::InvalidSyntax, 'Cannot coerce for Vedeu::View::Lines, as collection ' \ 'unrecognised.' end end |