Class: Ditz::Config
- Inherits:
-
ModelObject
show all
- Defined in:
- lib/ditz/plugins/git.rb,
lib/ditz/model-objects.rb,
lib/ditz/plugins/git-sync.rb,
lib/ditz/plugins/mercurial.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, #save!, #serialized_form_of, #to_s, #to_yaml, #to_yaml_type, #unchanged!, yaml_domain, yaml_other_thing
Instance Method Details
#get_default_email ⇒ Object
368
369
370
371
372
373
374
375
376
|
# File 'lib/ditz/model-objects.rb', line 368
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
358
359
360
361
362
363
364
365
366
|
# File 'lib/ditz/model-objects.rb', line 358
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
|
#get_paginate ⇒ Object
348
349
350
351
|
# File 'lib/ditz/model-objects.rb', line 348
def get_paginate
page = ask "Paginate output (always/never/auto)?", :restrict => /^(always|never|auto)$/i
page.downcase
end
|
#get_use_editor ⇒ Object
353
354
355
356
|
# File 'lib/ditz/model-objects.rb', line 353
def get_use_editor
yon = ask "Use your text editor for multi-line input when possible (y/n)?", :restrict => /^(y|yes|n|no)$/i
yon =~ /y/ ? true : false
end
|
342
|
# File 'lib/ditz/model-objects.rb', line 342
def user; "#{name} <#{email}>" end
|
#validate!(whence, context) ⇒ Object