fixes locals

This commit is contained in:
zmagod 2017-03-09 09:55:15 +01:00
parent f78ef8c82a
commit 49f91184da
2 changed files with 5 additions and 10 deletions

View file

@ -1,6 +1,7 @@
module ReportActions
extend ActiveSupport::Concern
def in_params?(val)
params.include? val and params[val] == '1'
end

View file

@ -22,28 +22,22 @@ module ReportExtends
ModuleElement = Struct.new(:element,
:children,
:locals,
:coll,
:options) do
def initialize(element, children, locals, coll = {}, options = {})
super(element, children, locals, coll, options)
:coll) do
def initialize(element, children, locals, coll = nil)
super(element, children, locals, coll)
end
def collection(my_module)
coll.call(my_module)
coll.call(my_module) if coll
end
def parse_locals(values)
container = {}
values.concat(add_local_values) unless add_local_values == :no_value
locals.each_with_index do |local, index|
container[local] = values[index]
end
container
end
def add_local_values
options.fetch(:add_values) { :no_value }
end
end
# Module contents element