Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Memoize instance method values.

  • Loading branch information...
commit 4a70d9b8c18f4c31ca3108dec089601e38162f13 1 parent b106398
@jnunemaker authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/user_agent.rb
View
12 lib/user_agent.rb
@@ -145,27 +145,27 @@ def initialize(source)
end
def name
- self.class.browser_name(source)
+ @name ||= self.class.browser_name(source)
end
def version
- self.class.version(source)
+ @version ||= self.class.browser_version(source)
end
def engine
- self.class.engine(source)
+ @engine ||= self.class.engine(source)
end
def engine_version
- self.class.engine_version(source)
+ @engine_version ||= self.class.engine_version(source)
end
def os
- self.class.os(source)
+ @os ||= self.class.os(source)
end
def platform
- self.class.platform(source)
+ @platform ||= self.class.platform(source)
end
def to_s
Please sign in to comment.
Something went wrong with that request. Please try again.