call to_s on the configured class

This commit is contained in:
Benjamin Neff 2015-07-02 02:43:50 +02:00
parent a70e2861fa
commit 7cf8339b59
2 changed files with 7 additions and 2 deletions

View file

@ -22,7 +22,7 @@ module DiasporaFederation
# the class to use as +Person+ # the class to use as +Person+
# #
# @example # @example
# config.person_class = Person.to_s # config.person_class = Person
# #
# This class must have the following class methods::: # This class must have the following class methods:::
# #
@ -87,6 +87,11 @@ module DiasporaFederation
# +last_name+: last name # +last_name+: last name
# "Name" # "Name"
attr_accessor :person_class attr_accessor :person_class
def person_class=(klass)
@person_class = klass.to_s
end
def person_class def person_class
const_get(@person_class) const_get(@person_class)
end end

View file

@ -4,5 +4,5 @@ DiasporaFederation.configure do |config|
config.server_uri = URI("http://localhost:3000/") config.server_uri = URI("http://localhost:3000/")
# the class to be used for a person # the class to be used for a person
config.person_class = Person.to_s config.person_class = Person
end end