Class: Newspaper

Inherits:
Biblioref show all
Defined in:
lib/dsl/references.rb

Instance Attribute Summary collapse

Attributes inherited from Biblioref

#author_name, #author_surname, #edit_num, #p_date, #p_house, #p_place, #title_, #volume

Instance Method Summary collapse

Constructor Details

#initialize(params = {}, &block) ⇒ Newspaper

Returns a new instance of Newspaper.



112
113
114
115
# File 'lib/dsl/references.rb', line 112

def initialize(params = {}, &block)
  super
  instance_eval &block
end

Instance Attribute Details

#pageObject

Título de artículo



110
111
112
# File 'lib/dsl/references.rb', line 110

def page
  @page
end

#title_aObject

Título de artículo



110
111
112
# File 'lib/dsl/references.rb', line 110

def title_a
  @title_a
end

Instance Method Details

#<=>(another) ⇒ Object



130
131
132
133
134
135
136
137
# File 'lib/dsl/references.rb', line 130

def <=>(another)
        if self.author_surname == another.author_surname && self.p_date==another.p_date
          self.author_surname<=>another.author_surname
    self.title_a<=>another.title_a
else
  super
end
end

#to_sObject



117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/dsl/references.rb', line 117

def to_s
  fullnames = ""
       i=0
  while i < self.author_name.count
if i != self.author_name.count-1
  fullnames= fullnames + "#{self.author_surname[i]}, #{self.author_name[i][0]}. & "
else
  fullnames= fullnames + "#{self.author_surname[i]}, #{self.author_name[i][0]}."
end
  i=i+1
end
   "#{fullnames} (#{self.p_date}). #{self.title_a}. #{self.title_}, pp. #{self.page}."
end