Created
April 11, 2014 14:03
-
-
Save stephenprater/10471555 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyDumbPresenter | |
attr_accessor :the_thing, :something | |
attr_writer :the_rest | |
def initialize(*all_the_things) | |
self.the_thing, self.something, self.the_rest = all_the_things | |
end | |
def has_the_thing? | |
if the_thing.present? | |
yield the_thing | |
end | |
end | |
def with_something | |
if something.present? | |
yield | |
end | |
end | |
def the_rest | |
@the_rest.each do |one| | |
yield one | |
end | |
end | |
end | |
#content | |
- presenter.has_the_thing? do |thing| | |
%span.thing | |
= thing | |
- presenter.with_something do | |
%span.something | |
= presenter.something | |
%ul | |
- presenter.the_rest do |el| | |
%li= el | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment