Define ci entry accessor instead of method_missing

This commit is contained in:
Grzegorz Bizon 2016-06-10 11:32:49 +02:00
parent 12080ba150
commit 5abfc7fa71
2 changed files with 6 additions and 7 deletions

View File

@ -55,6 +55,12 @@ module Gitlab
{ class: entry_class,
description: metadata[:description] } }
define_method(symbol) do
raise Entry::InvalidError unless valid?
@nodes[symbol].try(:value)
end
(@allowed_nodes ||= {}).merge!(node)
end
end

View File

@ -52,13 +52,6 @@ module Gitlab
{}
end
def method_missing(name, *args)
super unless allowed_nodes.has_key?(name)
raise InvalidError unless valid?
@nodes[name].try(:value)
end
def add_node(key, entry)
raise NotImplementedError
end