Class: Ditz::Config
- Inherits:
-
ModelObject
show all
- Defined in:
- lib/plugins/git.rb,
lib/model-objects.rb,
lib/plugins/git-sync.rb
Instance Method Summary
collapse
Methods inherited from ModelObject
#changed!, #changed?, changes_are_logged, create, 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
335
336
337
338
339
340
341
342
343
|
# File 'lib/model-objects.rb', line 335
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
325
326
327
328
329
330
331
332
333
|
# File 'lib/model-objects.rb', line 325
def get_default_name
require 'etc'
name = if ENV["USER"]
pwent = Etc.getpwnam ENV["USER"]
pwent ? pwent.gecos.split(/,/).first : nil
end
name || "Ditz User"
end
|
323
|
# File 'lib/model-objects.rb', line 323
def user; "#{name} <#{email}>" end
|