Class: Refinery::WordPress::Comment
- Inherits:
-
Object
- Object
- Refinery::WordPress::Comment
- Defined in:
- lib/wordpress/comment.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #approved? ⇒ Boolean
- #author ⇒ Object
- #content ⇒ Object
- #date ⇒ Object
- #email ⇒ Object
-
#initialize(node) ⇒ Comment
constructor
A new instance of Comment.
- #to_refinery ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(node) ⇒ Comment
Returns a new instance of Comment.
6 7 8 |
# File 'lib/wordpress/comment.rb', line 6 def initialize(node) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
4 5 6 |
# File 'lib/wordpress/comment.rb', line 4 def node @node end |
Instance Method Details
#==(other) ⇒ Object
34 35 36 |
# File 'lib/wordpress/comment.rb', line 34 def ==(other) (email == other.email) && (date == other.date) && (content == other.content) end |
#approved? ⇒ Boolean
30 31 32 |
# File 'lib/wordpress/comment.rb', line 30 def approved? node.xpath('wp:comment_approved').text.to_i == 1 end |
#author ⇒ Object
10 11 12 |
# File 'lib/wordpress/comment.rb', line 10 def node.xpath('wp:comment_author').text end |
#content ⇒ Object
26 27 28 |
# File 'lib/wordpress/comment.rb', line 26 def content node.xpath('wp:comment_content').text end |
#date ⇒ Object
22 23 24 |
# File 'lib/wordpress/comment.rb', line 22 def date DateTime.parse node.xpath("wp:comment_date").text end |
#email ⇒ Object
14 15 16 |
# File 'lib/wordpress/comment.rb', line 14 def email node.xpath('wp:comment_author_email').text end |
#to_refinery ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/wordpress/comment.rb', line 38 def to_refinery comment = BlogComment.new :name => , :email => email comment.body = content comment.created_at = date comment.state = approved? ? 'approved' : 'rejected' comment end |
#url ⇒ Object
18 19 20 |
# File 'lib/wordpress/comment.rb', line 18 def url node.xpath('wp:comment_author_url').text end |