Created
August 23, 2015 17:54
-
-
Save mayra-cabrera/608134a66f470c638b1b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 PostDecorator | |
attr_reader :post | |
def initialize post | |
@post = post | |
end | |
def is_recent? | |
published_at > 2.days.ago | |
end | |
def method_missing(method_name, &args, &block) | |
post.send(method_name, &args, &block) | |
end | |
def respond_to_missing?(method_name, include_private = false) | |
post.respond_to_?(method_name, include_private) || super | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment