Class: Author

Inherits:
Object
  • Object
show all
Defined in:
lib/cite_mapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name) ⇒ Author

Returns a new instance of Author.



57
58
59
60
61
# File 'lib/cite_mapper.rb', line 57

def initialize(id, name)
  @id = id
  @name = name
  @works = {}
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



55
56
57
# File 'lib/cite_mapper.rb', line 55

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



55
56
57
# File 'lib/cite_mapper.rb', line 55

def name
  @name
end

Instance Method Details

#[](id) ⇒ Object



63
64
65
# File 'lib/cite_mapper.rb', line 63

def [](id)
  @works[id]
end

#add_work(id, name) ⇒ Object



67
68
69
# File 'lib/cite_mapper.rb', line 67

def add_work(id,  name)
  @works[id] = Work.new(id, name)
end