Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

memoize attributes

  • Loading branch information...
commit e0434253b31c48d7a38908757c7e002304fdcf9e 1 parent 8f67c1c
Julien Kirch archiloque authored
2  lib/feedzirra/feed_entry_utilities.rb
@@ -16,7 +16,7 @@ def parse_datetime(string)
16 16 ##
17 17 # Returns the id of the entry or its url if not id is present, as some formats don't support it
18 18 def id
19   - @entry_id || @url
  19 + @entry_id ||= @url
20 20 end
21 21
22 22 ##
2  lib/feedzirra/parser/atom.rb
@@ -28,7 +28,7 @@ def url
28 28 end
29 29
30 30 def feed_url
31   - @feed_url || links.first
  31 + @feed_url ||= links.first
32 32 end
33 33 end
34 34 end
2  lib/feedzirra/parser/atom_entry.rb
@@ -30,7 +30,7 @@ class AtomEntry
30 30 elements :link, :as => :links, :value => :href
31 31
32 32 def url
33   - @url || links.first
  33 + @url ||= links.first
34 34 end
35 35 end
36 36
2  lib/feedzirra/parser/atom_feed_burner_entry.rb
@@ -31,7 +31,7 @@ class AtomFeedBurnerEntry
31 31 elements :link, :as => :links, :value => :href
32 32
33 33 def url
34   - @url || links.first
  34 + @url ||= links.first
35 35 end
36 36
37 37 end

0 comments on commit e043425

Please sign in to comment.
Something went wrong with that request. Please try again.