Skip to content

Instantly share code, notes, and snippets.

@mayra-cabrera
Created August 23, 2015 17:54
Show Gist options
  • Save mayra-cabrera/608134a66f470c638b1b to your computer and use it in GitHub Desktop.
Save mayra-cabrera/608134a66f470c638b1b to your computer and use it in GitHub Desktop.
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