lfa-wordpress-import/lib/wordpress/author.rb
Marc Remolt a45f502f44 Conversion in a gem finished
* specs are working again
* added railitie
* added missing migration (acts-as-taggable)
* cleanups
2011-06-02 14:41:31 +02:00

38 lines
744 B
Ruby

module Refinery
module WordPress
class Author
attr_reader :author_node
def initialize(author_node)
@author_node = author_node
end
def login
author_node.xpath("wp:author_login").text
end
def email
author_node.xpath("wp:author_email").text
end
def ==(other)
login == other.login
end
def inspect
"WordPress::Author: #{login} <#{email}>"
end
def to_refinery
user = User.find_or_initialize_by_username_and_email(login, email)
unless user.persisted?
user.password = 'password'
user.password_confirmation = 'password'
user.save
end
user
end
end
end
end