cite-me 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cite_me.rb +13 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71c35871362a78c8b518950a6d58a618c9b1b0a1
4
- data.tar.gz: 28926c2f0154b330c9bf75d36f1c4ecd388361f8
3
+ metadata.gz: 144f2e5f846be3678036287b251b3da27b390d3a
4
+ data.tar.gz: 22c5cda12c1bf9902c4f2c993f588251470a376d
5
5
  SHA512:
6
- metadata.gz: 471fc4444ecdaf98db233d6462f8070b9f6db1e7fdb796d0965ef1b877f38336dacb01f6b0098a3ffc3ec9a30976fcb637a72b394654678aa03ab9c2c3e3ee44
7
- data.tar.gz: 23fc7f6c996d8d3481be3571215773c7d688f1fb1a8fd0547235da2cd58d46358a5e8b312fb7add12efbabd46617a54d9c2f180d82a06c46371f38cbe5cd658a
6
+ metadata.gz: 64aabc5a1ec8a731b944dff9d0a11a8c9349900bb67cdb4a85d6f05e243de5953974161bc8bb2e8360ca68bc7ab48135c9f84d045efb5054d8d59ebe82ee385b
7
+ data.tar.gz: aedae4ec1d453417408c94b60b792b6626736b674e520c9a6082abd2e52a4541e6df093c6b4d7fb5abf724b9ce7cbb5a161adb8c501791eadd970b36f8081c22
@@ -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
- author_info = clean_options[:authors] ? authors(clean_options[:authors]) : authors(clean_options[:author])
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cite-me
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Smith