Class: Ditz::Config

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

Instance Method Summary collapse

Methods inherited from ModelObject

#after_deserialize, #before_serialize, #changed!, #changed?, changes_are_logged, create_interactively, #each_modelobject, field, fields, from, inherited, #log, #save!, #to_yaml_properties, #to_yaml_type, yaml_domain, yaml_other_thing

Instance Method Details

#get_default_emailObject



257
258
259
260
261
262
263
264
265
# File 'lib/model-objects.rb', line 257

def get_default_email
  require 'socket'
  email = ENV["USER"] + "@" + 
    begin
      Socket.gethostbyname(Socket.gethostname).first
    rescue SocketError
      Socket.gethostname
    end
end

#get_default_nameObject



251
252
253
254
255
# File 'lib/model-objects.rb', line 251

def get_default_name
  require 'etc'

  name = Etc.getpwnam(ENV["USER"]).gecos.split(/,/).first
end

#userObject



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

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