Move template to external file

This commit is contained in:
Rafa de la Torre 2015-11-17 16:14:26 +01:00
parent 584a76b927
commit 0f953dd5b6
2 changed files with 4 additions and 4 deletions

View File

@ -9,18 +9,17 @@ GEOCODER_CLIENT_SCHEMA = 'cdb_geocoder_client'
INTERFACE_SOURCE_FILE = 'interface.csv'
class GrantExecute
TEMPLATE=<<-END
GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %>(<%= function_signature['argument_data_types'] %>) TO publicuser;
END
TEMPLATE_FILE = 'templates/grant-execute.erb'
attr_reader :function_signature
def initialize(function_signature)
@function_signature = function_signature
@template = File.read(TEMPLATE_FILE)
end
def render
ERB.new(TEMPLATE).result(binding)
ERB.new(@template).result(binding)
end
end

View File

@ -0,0 +1 @@
GRANT EXECUTE ON FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= function_signature['function_name'] %>(<%= function_signature['argument_data_types'] %>) TO publicuser;