Class: Ditz::Config
Instance Method Summary
collapse
Methods inherited from ModelObject
#changed!, #changed?, changes_are_logged, create_interactively, #deserialized_form_of, #each_modelobject, field, field_names, from, inherited, #initialize, #inspect, #log, #save!, #serialized_form_of, #to_s, #to_yaml, #to_yaml_type, #unchanged!, yaml_domain, yaml_other_thing
Instance Method Details
#get_default_email ⇒ Object
302
303
304
305
306
307
308
309
310
|
# File 'lib/model-objects.rb', line 302
def get_default_email
require 'socket'
email = (ENV["USER"] || "") + "@" +
begin
Socket.gethostbyname(Socket.gethostname).first
rescue SocketError
Socket.gethostname
end
end
|
#get_default_name ⇒ Object
295
296
297
298
299
300
|
# File 'lib/model-objects.rb', line 295
def get_default_name
require 'etc'
name = Etc.getpwnam(ENV["USER"])
name = name ? name.gecos.split(/,/).first : ""
end
|
293
|
# File 'lib/model-objects.rb', line 293
def user; "#{name} <#{email}>" end
|