Sha256: 201852604cc53a881e4fa5a4e04c9b83b0b274f054c740622a80c7ed9f529b51
Contents?: true
Size: 807 Bytes
Versions: 1
Compression:
Stored size: 807 Bytes
Contents
require "#{File.dirname(__FILE__)}/../lib/stages" include Stages #count the occurance of each letter in these song lyrics @lyrics = { :do => 'doe a deer a female deer', :re => 'ray a drop of golden sun', :mi => 'me a name I call myself', :fa => 'far a long long way to run', :so => 'a needle pulling thread', :la => 'a note to follow so', :ti => 'a drink with jam and bread'} def setup_pipeline get_lyric = Map.new{ |x| @lyrics[x]} each_character = Each.new{ |x| x.chars } trim_whitespace = Select.new{ |x| x != ' '} letters_in_each_line = SubStage.new(get_lyric | each_character | trim_whitespace) each_note = Each.new @lyrics.keys count_everything = Count.new each_note | letters_in_each_line | count_everything end puts setup_pipeline.run.inspect
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stages-0.1.2 | examples/sing_subpipes.rb |