mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-28 19:24:10 +08:00
fixes locals
This commit is contained in:
parent
f78ef8c82a
commit
49f91184da
2 changed files with 5 additions and 10 deletions
|
@ -1,6 +1,7 @@
|
|||
module ReportActions
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
|
||||
def in_params?(val)
|
||||
params.include? val and params[val] == '1'
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue