Class: Taxonifi::Model::AuthorYear
- Defined in:
- lib/taxonifi/model/author_year.rb
Overview
A class to aggregate People and Year combinations.
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#parens ⇒ Object
The parens attribute reflects that this combinations was cited in parentheses.
-
#people ⇒ Object
Array of Taxonifi::Model::People.
-
#year ⇒ Object
String.
Attributes inherited from Base
Instance Method Summary collapse
-
#compact_index ⇒ Object
Return a string representing all data, used in indexing.
-
#initialize(options = {}) ⇒ AuthorYear
constructor
A new instance of AuthorYear.
Methods inherited from Base
#add_properties, #add_property, #ancestor_ids, #ancestors, #build, #delete_property, #replace_property
Methods included from SharedClassMethods
Constructor Details
#initialize(options = {}) ⇒ AuthorYear
Returns a new instance of AuthorYear.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/taxonifi/model/author_year.rb', line 15 def initialize( = {}) opts = { :people => [], :parens => false, :year => nil }.merge!() @parens = opts[:parens] @people = opts[:people] @year = opts[:year] end |
Instance Attribute Details
#parens ⇒ Object
The parens attribute reflects that this combinations was cited in parentheses.
13 14 15 |
# File 'lib/taxonifi/model/author_year.rb', line 13 def parens @parens end |
#people ⇒ Object
Array of Taxonifi::Model::People
8 9 10 |
# File 'lib/taxonifi/model/author_year.rb', line 8 def people @people end |
#year ⇒ Object
String
10 11 12 |
# File 'lib/taxonifi/model/author_year.rb', line 10 def year @year end |
Instance Method Details
#compact_index ⇒ Object
Return a string representing all data, used in indexing.
28 29 30 31 32 33 34 |
# File 'lib/taxonifi/model/author_year.rb', line 28 def compact_index index = [@year] @people.each do |a| index.push(a.compact_string) end index.join("-") end |