Commit 8c49eaa9 authored by Yorick Peterse's avatar Yorick Peterse

Cache Banzai class methods returning static data

These methods always return the same data for every class so there's no
point in computing their values on every call.
parent 14114805
......@@ -11,15 +11,15 @@ module Banzai
end
def self.object_name
object_class.name.underscore
@object_name ||= object_class.name.underscore
end
def self.object_sym
object_name.to_sym
@object_sym ||= object_name.to_sym
end
def self.data_reference
"data-#{object_name.dasherize}"
@data_reference ||= "data-#{object_name.dasherize}"
end
# Public: Find references in text (like `!123` for merge requests)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment