Skip to content

Instantly share code, notes, and snippets.

@etsai
Created January 25, 2012 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etsai/1678350 to your computer and use it in GitHub Desktop.
Save etsai/1678350 to your computer and use it in GitHub Desktop.
Story Presenter
Elaines-MacBook-Air:madlib elainetsai$ git pull github ruby_version
From github.com:etsai/madlib
* branch ruby_version -> FETCH_HEAD
Auto-merging views/story_presenter.rb
CONFLICT (content): Merge conflict in views/story_presenter.rb
Automatic merge failed; fix conflicts and then commit the result.
class StoryPresenter
attr_reader :story
def initialize story
@story = story
end
# <Say> I once went walking along a </Say><Play> asfadsgas.dasfdasmai.mp3</Play> <Say>when I ...</Say>
def telling_xml
xml = ""
@story.telling.each do |phrase|
case phrase
when String
<<<<<<< HEAD
xml.Say phrase
=======
xml << "<Say>#{phrase}</Say>"
>>>>>>> c8ad3498046eba39cf6e303379531ba2cfb16199
when Word
xml << "<Play>#{phrase.url}</Play>"
end
end
xml
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment