Class: ComparableReference

Inherits:
Object
  • Object
show all
Includes:
ReferenceComparable
Defined in:
app/models/comparable_reference.rb

Direct Known Subclasses

Hol::Reference

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from ReferenceComparable

#<=>

Constructor Details

- (ComparableReference) initialize(hash = {})

A new instance of ComparableReference



6
7
8
# File 'app/models/comparable_reference.rb', line 6

def initialize hash = {}
  update hash
end

Instance Attribute Details

- (Object) author

Returns the value of attribute author



4
5
6
# File 'app/models/comparable_reference.rb', line 4

def author
  @author
end

- (Object) pagination

Returns the value of attribute pagination



4
5
6
# File 'app/models/comparable_reference.rb', line 4

def pagination
  @pagination
end

- (Object) series_volume_issue

Returns the value of attribute series_volume_issue



4
5
6
# File 'app/models/comparable_reference.rb', line 4

def series_volume_issue
  @series_volume_issue
end

- (Object) title

Returns the value of attribute title



4
5
6
# File 'app/models/comparable_reference.rb', line 4

def title
  @title
end

- (Object) type

Returns the value of attribute type



4
5
6
# File 'app/models/comparable_reference.rb', line 4

def type
  @type
end

- (Object) year

Returns the value of attribute year



4
5
6
# File 'app/models/comparable_reference.rb', line 4

def year
  @year
end

Instance Method Details

- (Object) id



16
17
18
# File 'app/models/comparable_reference.rb', line 16

def id
  object_id
end

- (Object) to_s



20
21
22
# File 'app/models/comparable_reference.rb', line 20

def to_s
  "#{type}: #{author}, #{year}. #{title}. #{series_volume_issue}. #{pagination}"
end

- (Object) update(hash)



10
11
12
13
14
# File 'app/models/comparable_reference.rb', line 10

def update hash
  hash.each do |key, value|
    send "#{key}=", value
  end
end