Sha256: 45a62eff7fac2f86e5aa671e2399804b1d8f002e48469ffb262c722e934c2a0b

Contents?: true

Size: 669 Bytes

Versions: 6

Compression:

Stored size: 669 Bytes

Contents

# todo - add some sort of error/warning if loading with the 0.x cuke_modeler?

module CukeModeler

  # A monkey patch that allows models to be queried directly by having them use this gem's query module.

  class Model

    include CQL::Queriable


    # Hanging on to the original method so that it can be invoked and thus ensure that all of the normal, un-patched behavior occurs
    alias_method :original_initialize, :initialize


    # Sets itself as the model's *query_root*. Otherwise, as per the un-patched method.
    def initialize(source_text = nil)
      original_initialize(source_text)

      @query_root = self
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cql-1.7.0 lib/cql/model_dsl.rb
cql-1.6.0 lib/cql/model_dsl.rb
cql-1.5.1 lib/cql/model_dsl.rb
cql-1.5.0 lib/cql/model_dsl.rb
cql-1.4.2 lib/cql/model_dsl.rb
cql-1.4.1 lib/cql/model_dsl.rb