Class: Contact

Inherits:
Object
  • Object
show all
Defined in:
lib/public/doc/plain-text-files/contacts_g.rb,
lib/public/doc/plain-text-files/contacts_y.rb

Constant Summary collapse

COMPONENTS =
["home", "extras", "work"]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Contact

Returns a new instance of Contact.



76
77
78
79
# File 'lib/public/doc/plain-text-files/contacts_g.rb', line 76

def initialize(name)
  @name = name
  @dirname = @name.gsub(" ", "_")
end

Instance Attribute Details

#dirnameObject (readonly)

Returns the value of attribute dirname.



74
75
76
# File 'lib/public/doc/plain-text-files/contacts_g.rb', line 74

def dirname
  @dirname
end

#emailObject

Returns the value of attribute email.



97
98
99
# File 'lib/public/doc/plain-text-files/contacts_g.rb', line 97

def email
  extras["email"]
end

#extrasObject (readonly)

Returns the value of attribute extras.



47
48
49
# File 'lib/public/doc/plain-text-files/contacts_y.rb', line 47

def extras
  @extras
end

#homeObject (readonly)

Returns the value of attribute home.



47
48
49
# File 'lib/public/doc/plain-text-files/contacts_y.rb', line 47

def home
  @home
end

#nameObject

Returns the value of attribute name.



47
48
49
# File 'lib/public/doc/plain-text-files/contacts_y.rb', line 47

def name
  @name
end

#workObject (readonly)

Returns the value of attribute work.



47
48
49
# File 'lib/public/doc/plain-text-files/contacts_y.rb', line 47

def work
  @work
end

Instance Method Details

#closeObject



91
92
93
94
95
# File 'lib/public/doc/plain-text-files/contacts_g.rb', line 91

def close
  components.each do |component|
    component.close unless component.closed?
  end
end

#componentsObject



81
82
83
# File 'lib/public/doc/plain-text-files/contacts_g.rb', line 81

def components
  COMPONENTS.map {|comp_name| self.send(comp_name) }
end

#openObject



85
86
87
88
89
# File 'lib/public/doc/plain-text-files/contacts_g.rb', line 85

def open
  COMPONENTS.each do |component|
    self.send(component + "=", GDBM.new(component))
  end
end