Sha256: 6c4580e3a99867342de9f04db7702c830288767671368e10ec53a04de675c77b
Contents?: true
Size: 738 Bytes
Versions: 40
Compression:
Stored size: 738 Bytes
Contents
# Custom fields need to add a table join to the customfieldsearch table when AND'd together, # but not when they are OR'd or nested. This class maintains the state for all custom field expressions # lets the parser know when to do either. class Sparkql::ExpressionState def initialize @expressions = {0=>[]} @last_conjunction = "And" # always start with a join @block_group = 0 end def push(expression) @block_group = expression[:block_group] @expressions[@block_group] ||= [] @expressions[@block_group] << expression @last_conjunction = expression[:conjunction] end def needs_join? return @expressions[@block_group].size == 1 || ["Not", "And"].include?(@last_conjunction) end end
Version data entries
40 entries across 40 versions & 1 rubygems