cite-me 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cite_me.rb +13 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 144f2e5f846be3678036287b251b3da27b390d3a
|
4
|
+
data.tar.gz: 22c5cda12c1bf9902c4f2c993f588251470a376d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64aabc5a1ec8a731b944dff9d0a11a8c9349900bb67cdb4a85d6f05e243de5953974161bc8bb2e8360ca68bc7ab48135c9f84d045efb5054d8d59ebe82ee385b
|
7
|
+
data.tar.gz: aedae4ec1d453417408c94b60b792b6626736b674e520c9a6082abd2e52a4541e6df093c6b4d7fb5abf724b9ce7cbb5a161adb8c501791eadd970b36f8081c22
|
data/lib/cite_me.rb
CHANGED
@@ -23,11 +23,11 @@ class Cite_Me
|
|
23
23
|
clean_options = clean_hash(options)
|
24
24
|
case clean_options[:source_type]
|
25
25
|
when 'book'
|
26
|
-
mla_book_generate_citation(clean_options)
|
26
|
+
mla_book_generate_citation(clean_options).strip
|
27
27
|
when 'magazine'
|
28
|
-
mla_magazine_generate_citation(clean_options)
|
28
|
+
mla_magazine_generate_citation(clean_options).strip
|
29
29
|
when 'web'
|
30
|
-
mla_web_generate_citation(clean_options)
|
30
|
+
mla_web_generate_citation(clean_options).strip
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -35,7 +35,7 @@ class Cite_Me
|
|
35
35
|
|
36
36
|
def mla_book_generate_citation(clean_options)
|
37
37
|
output = ''
|
38
|
-
output << author_info(clean_options)
|
38
|
+
output << author_info(clean_options)
|
39
39
|
output << "<i>" + clean_options[:title] + "</i>. " if clean_options[:title]
|
40
40
|
output << clean_options[:city_of_publication] + ": " if clean_options[:city_of_publication]
|
41
41
|
output << clean_options[:publisher] + ", " if clean_options[:publisher]
|
@@ -98,7 +98,14 @@ class Cite_Me
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def author_info(clean_options)
|
101
|
-
|
101
|
+
if clean_options[:authors]
|
102
|
+
authors(clean_options[:authors])
|
103
|
+
elsif clean_options[:author]
|
104
|
+
authors(clean_options[:author])
|
105
|
+
else
|
106
|
+
# return empty string so it can concat it without error
|
107
|
+
''
|
108
|
+
end
|
102
109
|
end
|
103
110
|
|
104
111
|
def year_of_publication(option)
|
@@ -111,7 +118,7 @@ class Cite_Me
|
|
111
118
|
|
112
119
|
def clean_hash(options)
|
113
120
|
clean_options = {}
|
114
|
-
if options.class.ancestors.include?(ActiveRecord::Base)
|
121
|
+
if options.class.ancestors.to_s.include?('ActiveRecord::Base')
|
115
122
|
options = options.attributes
|
116
123
|
end
|
117
124
|
|