lib/vedeu/views/streams.rb in vedeu-0.8.3 vs lib/vedeu/views/streams.rb in vedeu-0.8.4

- old
+ new

@@ -35,18 +35,23 @@ new(coerced_collection, parent, name) elsif collection.is_a?(Vedeu::Views::Stream) new([collection], parent, name) + elsif collection.is_a?(Vedeu::Views::Chars) + return new([], parent, name) if collection.empty? + + new([Vedeu::Views::Stream.new(value: collection)], parent, name) + elsif collection.is_a?(String) return new([], parent, name) if collection.empty? new([Vedeu::Views::Stream.new(value: collection)], parent, name) else fail Vedeu::Error::InvalidSyntax, 'Cannot coerce for Vedeu::View::Streams, as collection ' \ - 'unrecognised.' + "unrecognised. (#{collection.class.name})" end end alias_method :streams, :value