lib/gutenberg_rdf/rdf/agent.rb in gutenberg_rdf-0.2.3 vs lib/gutenberg_rdf/rdf/agent.rb in gutenberg_rdf-0.3.1
- old
+ new
@@ -1,9 +1,10 @@
module GutenbergRdf
class Rdf
class Agent
attr_reader :xml
+ attr_accessor :role
def initialize(xml)
@xml = xml
end
@@ -11,9 +12,17 @@
fullname
end
def id
xml.attributes['about'].match(/\A\d\d\d\d\/agents\/(\d+)\z/)[1]
+ end
+
+ def role
+ @role ||= 'oth'
+ end
+
+ def assign_role(roles)
+ self.role = roles["#{id}"]
end
def fullname
[firstname, lastname].reject(&:empty?).join(' ')
end