class ContentSpinning::Spinner
Public Class Methods
new(*items)
click to toggle source
# File lib/content_spinning/spinner.rb, line 6 def initialize(*items) push(*items) end
Public Instance Methods
cleaned()
click to toggle source
# File lib/content_spinning/spinner.rb, line 10 def cleaned map!(&:cleaned) uniq! if length == 1 first else self end end
count()
click to toggle source
# File lib/content_spinning/spinner.rb, line 22 def count map(&:count).inject(:+) end
inspect()
click to toggle source
# File lib/content_spinning/spinner.rb, line 26 def inspect "<Spinner {#{map(&:inspect).join(" | ")}}>" end
random()
click to toggle source
# File lib/content_spinning/spinner.rb, line 30 def random sample.random end
spin()
click to toggle source
# File lib/content_spinning/spinner.rb, line 34 def spin flat_map(&:spin) end
to_source()
click to toggle source
# File lib/content_spinning/spinner.rb, line 38 def to_source "{#{map(&:to_source).join("|")}}" end