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, #initialize, #log, #save!, #to_yaml_properties, #to_yaml_type, yaml_domain, yaml_other_thing

Constructor Details

This class inherits a constructor from Ditz::ModelObject

Instance Method Details

#get_default_emailObject



254
255
256
257
258
259
260
261
262
# File 'lib/model-objects.rb', line 254

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

#get_default_nameObject



248
249
250
251
252
# File 'lib/model-objects.rb', line 248

def get_default_name
  require 'etc'

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

#userObject



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

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