Sha256: c58182461eb6fbde617e2f8ad3205f39b3e98742e1544adc611e3918976f2943

Contents?: true

Size: 759 Bytes

Versions: 5

Compression:

Stored size: 759 Bytes

Contents

class StreamForOccurrenceDouble < ConceptQL::Nodes::Node
  def query(db)
    ds = db.from(:table)
    # Occurrence needs window functions to work
    meta_def(ds, :supports_window_functions?){true}
    ds
  end

  def evaluate(db)
    query(db)
  end

  # Stole this from:
  # https://github.com/jeremyevans/sequel/blob/63397b787335d06de97dc89ddf49b7a3a93ffdc9/spec/core/expression_filters_spec.rb#L400
  #
  # By default, the Sequel.mock datasets don't allow window functions, but I need them
  # enabled for testing
  #
  # I saw that Sequel tests had this little nugget in them to temporarily enable
  # window functions and sure enough, it works
  def meta_def(obj, name, &block)
    (class << obj; self end).send(:define_method, name, &block)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
conceptql-0.1.1 spec/doubles/stream_for_occurrence_double.rb
conceptql-0.1.0 spec/doubles/stream_for_occurrence_double.rb
conceptql-0.0.9 spec/doubles/stream_for_occurrence_double.rb
conceptql-0.0.8 spec/doubles/stream_for_occurrence_double.rb
conceptql-0.0.7 spec/doubles/stream_for_occurrence_double.rb