Class: FeedItem
- Inherits:
-
Object
- Object
- FeedItem
- Defined in:
- app/models/feed_item.rb
Overview
FeedItems are used to represent RSS atom items Used e.g. in HomeController as
FeedItem.new( ("%s %% %s" % [posting.title,comment.name]),
comment.comment,
comment.updated_at,
posting_url(posting),comment)
Instance Attribute Summary (collapse)
-
- (Object) body
readonly
Returns the value of attribute body.
-
- (Object) object
readonly
Returns the value of attribute object.
-
- (Object) title
readonly
Returns the value of attribute title.
-
- (Object) updated_at
readonly
Returns the value of attribute updated_at.
-
- (Object) url
readonly
Returns the value of attribute url.
Instance Method Summary (collapse)
-
- (FeedItem) initialize(title, body, updated_at, url, object)
constructor
A new instance of FeedItem.
-
- (Object) method_missing(method_sym, *arguments, &block)
If the user calls any method we try to delegate to our @object.
-
- (Object) name
The name of the object if object respond to :name or the application name as configured otherwise.
Constructor Details
- (FeedItem) initialize(title, body, updated_at, url, object)
A new instance of FeedItem
17 18 19 |
# File 'app/models/feed_item.rb', line 17 def initialize(title, body, updated_at, url, object) @title,@body,@updated_at,@url,@object = title, body, updated_at, url, object end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(method_sym, *arguments, &block)
If the user calls any method we try to delegate to our @object
34 35 36 |
# File 'app/models/feed_item.rb', line 34 def method_missing(method_sym, *arguments, &block) object.send(method_sym,*arguments) end |
Instance Attribute Details
- (Object) body (readonly)
Returns the value of attribute body
11 12 13 |
# File 'app/models/feed_item.rb', line 11 def body @body end |
- (Object) object (readonly)
Returns the value of attribute object
11 12 13 |
# File 'app/models/feed_item.rb', line 11 def object @object end |
- (Object) title (readonly)
Returns the value of attribute title
11 12 13 |
# File 'app/models/feed_item.rb', line 11 def title @title end |
- (Object) updated_at (readonly)
Returns the value of attribute updated_at
11 12 13 |
# File 'app/models/feed_item.rb', line 11 def updated_at @updated_at end |
- (Object) url (readonly)
Returns the value of attribute url
11 12 13 |
# File 'app/models/feed_item.rb', line 11 def url @url end |
Instance Method Details
- (Object) name
The name of the object if object respond to :name or the application name as configured otherwise.
23 24 25 26 27 28 29 |
# File 'app/models/feed_item.rb', line 23 def name if object.respond_to?(:name) && object.name !~ /anonymous|anonym/ object.name else APPLICATION_CONFIG[:name] end end |