Class: EDoc

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) ⇒ EDoc

Returns a new instance of EDoc.



144
145
146
147
# File 'lib/dsl/references.rb', line 144

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

Instance Attribute Details

#a_dateObject

Dirección de documento electrónico



141
142
143
# File 'lib/dsl/references.rb', line 141

def a_date
  @a_date
end

#mediumObject

Dirección de documento electrónico



141
142
143
# File 'lib/dsl/references.rb', line 141

def medium
  @medium
end

#urlObject

Dirección de documento electrónico



141
142
143
# File 'lib/dsl/references.rb', line 141

def url
  @url
end

Instance Method Details

#<=>(another) ⇒ Object



167
168
169
170
171
172
173
174
# File 'lib/dsl/references.rb', line 167

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

#to_sObject



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/dsl/references.rb', line 149

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
 if self.medium =="En línea"
      "#{fullnames} (#{self.p_date}). #{self.title_} (#{self.edit_num}), [#{self.medium}]. #{self.p_place}: #{self.p_house}. Disponible en: #{self.url} [#{self.a_date}]."
 else
     "#{fullnames} (#{self.p_date}). #{self.title_} (#{self.edit_num}), [#{self.medium}]. #{self.p_place}: #{self.p_house} [#{self.a_date}]."
 end
end