summaryrefslogtreecommitdiff
path: root/lib/person.rb
blob: 6ad15699f9fdd996c4c3e0ed71e2cdd014f56fe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# coding: utf-8
require 'config'

class Person
	def initialize(name)
		@name = name
	end
	def name
		@name
	end
	def uri
		Config::get.person_uri(@name)
	end
	def email
		Config::get.person_email(@name)
	end
	def html
		if not email.nil?
			return "<a href=\"mailto:#{email}\">#{name}</a>"
		elsif not uri.nil?
			return "<a href=\"#{uri}\">#{name}</a>"
		else
			return name
		end
	end
	def atom
		ret = ""
		ret += "<name>#{name}</name>" unless name.nil?
		ret += "<uri>#{uri}</uri>" unless uri.nil?
		ret += "<email>#{email}</email>" unless email.nil?
	end
end