git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1099 7926756e-e54e-46e6-9721-ed318f58905epull/6827/head
parent
ec1be6236b
commit
c168643463
@ -1,41 +1,42 @@ |
|||||||
class CostQuery::Walker |
class CostQuery::Walker |
||||||
def initialize(query) |
def initialize(query) |
||||||
|
@query = query |
||||||
end |
end |
||||||
|
|
||||||
## |
# ## |
||||||
# Fields which the walker recognizes as a group. Unknown fields or |
# # Fields which the walker recognizes as a group. Unknown fields or |
||||||
# fields which are not given (but appear in the result) will be ignored. |
# # fields which are not given (accepts_propertybut appear in the result) will be ignored. |
||||||
|
# # |
||||||
|
# # @overload follow_groups |
||||||
|
# # Reads the fields the walker recognizes as groups. |
||||||
|
# # @return [Array<#to_s>] fields |
||||||
|
# # @overload follow_groups(fields) |
||||||
|
# # Sets the fields which are recognized as groups by the walker. |
||||||
|
# # @param [Array<String, Symbol>] fields Field which are recognized as groups by the walker. |
||||||
|
# def follow_groups(fields = nil) |
||||||
|
# @fields ||= [] |
||||||
|
# @fields = fields if fields |
||||||
|
# @fields |
||||||
|
# end |
||||||
# |
# |
||||||
# @overload follow_groups |
# ## |
||||||
# Reads the fields the walker recognizes as groups. |
# # Defines which parameter wil be given to the block when doing the walk. |
||||||
# @return [Array<#to_s>] fields |
# # |
||||||
# @overload follow_groups(fields) |
# # @param [Block] The block, which gets the result and returns the parameter the walk-block needs. |
||||||
# Sets the fields which are recognized as groups by the walker. |
# def walk_param_from(&block) |
||||||
# @param [Array<String, Symbol>] fields Field which are recognized as groups by the walker. |
# @walk_param = block || { |result| result } # maybe this should be an empty array later. |
||||||
def follow_groups(fields = nil) |
# end |
||||||
@fields ||= [] |
|
||||||
@fields = fields if fields |
|
||||||
@fields |
|
||||||
end |
|
||||||
|
|
||||||
## |
|
||||||
# Defines which parameter wil be given to the block when doing the walk. |
|
||||||
# |
# |
||||||
# @param [Block] The block, which gets the result and returns the parameter the walk-block needs. |
# ## |
||||||
def walk_param_from(&block) |
# # Walks on the result and evaluates the block for each result as if we have nested group_by's. |
||||||
@walk_param = block || { |result| result } # maybe this should be an empty array later. |
# # The given block will get the parameter defined in @see CostQuery::Walker#walk_param_from |
||||||
end |
# def walk_on(&block) |
||||||
|
# #walking on sunshine! |
||||||
## |
# result.recursive_each_with_level 0 false do | level, current_result | |
||||||
# Walks on the result and evaluates the block for each result as if we have nested group_by's. |
# to_aggregate = @fields |
||||||
# The given block will get the parameter defined in @see CostQuery::Walker#walk_param_from |
# if r.fields.any? to_aggregate |
||||||
def walk_on(&block) |
# to_aggregate |
||||||
#walking on sunshine! |
# end |
||||||
result.recursive_each_with_level 0 false do | level, current_result | |
# end |
||||||
to_aggregate = @fields |
# end |
||||||
if r.fields.any? to_aggregate |
|
||||||
to_aggregate |
|
||||||
end |
|
||||||
end |
|
||||||
end |
|
||||||
end |
end |
||||||
|
Loading…
Reference in new issue