lib/redd/models/more_comments.rb in redd-0.8.0.pre.2 vs lib/redd/models/more_comments.rb in redd-0.8.0

- old
+ new

@@ -17,9 +17,14 @@ children: get_attribute(:children).join(','), sort: sort ) end + # @return [Array<String>] an array representation of self + def to_ary + get_attribute(:children) + end + # Keep expanding until all top-level MoreComments are converted to comments def recursive_expand(link:, sort: 'best') # FIXME: this returns a flattened listing of comments and doesn't preserve the structure expand(link: link, sort: sort).flat_map do |o| o.is_a?(MoreComments) && o.count > 0 ? o.recursive_expand(link: link, sort: sort) : [o]