Commit d67d2431 authored by Piotr Skorupa's avatar Piotr Skorupa

Add Struct freeze in UsageMetricDefinitionGenerator

Added freezing Directory struct on init, since it's meant to be
immutable anyway.
parent b1a72277
...@@ -5,6 +5,11 @@ require 'rails/generators' ...@@ -5,6 +5,11 @@ require 'rails/generators'
module Gitlab module Gitlab
class UsageMetricDefinitionGenerator < Rails::Generators::Base class UsageMetricDefinitionGenerator < Rails::Generators::Base
Directory = Struct.new(:name, :time_frame, :value_type) do Directory = Struct.new(:name, :time_frame, :value_type) do
def initialize(...)
super
freeze
end
def match?(str) def match?(str)
(name == str || time_frame == str) && str != 'none' (name == str || time_frame == str) && str != 'none'
end end
......
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