Class: Thredded::PostDecorator
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Thredded::PostDecorator
- Defined in:
- app/decorators/thredded/post_decorator.rb
Instance Attribute Summary collapse
-
#post ⇒ Object
readonly
Returns the value of attribute post.
Instance Method Summary collapse
- #avatar_url ⇒ Object
-
#initialize(post) ⇒ PostDecorator
constructor
A new instance of PostDecorator.
- #original ⇒ Object
- #to_ary ⇒ Object
- #user_name ⇒ Object
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 |