Skip to content

Instantly share code, notes, and snippets.

@m-k
Last active May 22, 2017 09:09
Show Gist options
  • Save m-k/79f741588183234d1313b692b9a135df to your computer and use it in GitHub Desktop.
Save m-k/79f741588183234d1313b692b9a135df to your computer and use it in GitHub Desktop.
class DiscussionViewObject
attr_reader :discussion
delegate :name, :created_at, to: :discussion
def initialize(discussion)
@discussion = discussion
end
def name_with_time
@_name_with_time ||= created_at.strftime('%Y/%m/%d') + name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment