Class: Thredded::PostDecorator

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/decorators/thredded/post_decorator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(post) ⇒ PostDecorator

Returns a new instance of PostDecorator.



5
6
7
8
# File 'app/decorators/thredded/post_decorator.rb', line 5

def initialize(post)
  super
  @post = post
end

Instance Attribute Details

#post ⇒ Object (readonly)

Returns the value of attribute post.



3
4
5
# File 'app/decorators/thredded/post_decorator.rb', line 3

def post
  @post
end

Instance Method Details

#avatar_url ⇒ Object



22
23
24
# File 'app/decorators/thredded/post_decorator.rb', line 22

def avatar_url
  super.sub(/\Ahttp:/, '')
end

#original ⇒ Object



18
19
20
# File 'app/decorators/thredded/post_decorator.rb', line 18

def original
  post
end

#to_ary ⇒ Object



26
27
28
# File 'app/decorators/thredded/post_decorator.rb', line 26

def to_ary
  [self]
end

#user_name ⇒ Object



10
11
12
13
14
15
16
# File 'app/decorators/thredded/post_decorator.rb', line 10

def user_name
  if user
    user.to_s
  else
    'Anonymous'
  end
end