Skip to content

Instantly share code, notes, and snippets.

@stephenprater
Created April 11, 2014 14:03
Show Gist options
  • Save stephenprater/10471555 to your computer and use it in GitHub Desktop.
Save stephenprater/10471555 to your computer and use it in GitHub Desktop.
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