Class: Ditz::Config

Inherits:
ModelObject show all
Defined in:
lib/plugins/git.rb,
lib/model-objects.rb

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

Constructor Details

This class inherits a constructor from Ditz::ModelObject

Instance Method Details

#get_default_emailObject



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_nameObject



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

#userObject



293
# File 'lib/model-objects.rb', line 293

def user; "#{name} <#{email}>" end