Class: EBook

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

Returns a new instance of EBook.



66
67
68
69
70
71
# File 'lib/dsl/references.rb', line 66

def initialize(params = {}, &block)
    super
    self.editor_name = []
    self.editor_surname = []
    instance_eval &block
end

Instance Attribute Details

#editor_nameObject

Título de artículo



62
63
64
# File 'lib/dsl/references.rb', line 62

def editor_name
  @editor_name
end

#editor_surnameObject

Título de artículo



62
63
64
# File 'lib/dsl/references.rb', line 62

def editor_surname
  @editor_surname
end

#pageObject

Título de artículo



62
63
64
# File 'lib/dsl/references.rb', line 62

def page
  @page
end

#title_aObject

Título de artículo



62
63
64
# File 'lib/dsl/references.rb', line 62

def title_a
  @title_a
end

Instance Method Details

#<=>(another) ⇒ Object



99
100
101
102
103
104
105
106
# File 'lib/dsl/references.rb', line 99

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



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/dsl/references.rb', line 73

def to_s
      editors = ""
 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
i=0
   while i < self.editor_name.count
if i == self.editor_name.count-1
  editors= editors + "#{self.editor_name[i][0]}. #{self.editor_surname[i]}"
elsif i == self.editor_name.count-2
  editors= editors + "#{self.editor_name[i][0]}. #{self.editor_surname[i]} & "
 else
 editors= editors + "#{self.editor_name[i][0]}. #{self.editor_surname[i]}, "
end
  i=i+1
end
  "#{fullnames} (#{self.p_date}). #{self.title_a}. En #{editors} (comps), #{self.title_} (pp. #{self.page}) (#{self.edit_num}) (#{self.volume}). #{self.p_place}: #{self.p_house}."
end