Sha256: 49591d809bb4e6394d112b7c295785addd870a80d96cf7756b464fc2431dbfe9
Contents?: true
Size: 812 Bytes
Versions: 1
Compression:
Stored size: 812 Bytes
Contents
require "#{File.dirname(__FILE__)}/../lib/stages" include Stages #count the occurance of each letter in these song lyrics def sing { :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'} end def setup_pipeline get_lyric = HashLookup.new sing each_character = EachInput.new{ |x| x.chars } trim_whitespace = Select.new{ |x| x != ' '} count_letters_in_line = SubStage.new(get_lyric | each_character | trim_whitespace) each_note = EachElement.new sing.keys count_everything = Count.new each_note | count_letters_in_line | count_everything end puts setup_pipeline.run.inspect
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stages-0.1.1 | examples/sing_subpipes.rb |