Class: CukeModeler::Model

Inherits:
Object
  • Object
show all
Includes:
CQL::Queriable
Defined in:
lib/cql/model_dsl.rb

Overview

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

Instance Attribute Summary

Attributes included from CQL::Queriable

#query_root

Instance Method Summary collapse

Methods included from CQL::Queriable

#query

Constructor Details

#initialize(source_text = nil) ⇒ Model

Sets itself as the model’s query_root. Otherwise, as per the un-patched method.



17
18
19
20
21
# File 'lib/cql/model_dsl.rb', line 17

def initialize(source_text = nil)
  original_initialize(source_text)

  @query_root = self
end

Instance Method Details

#original_initializeObject

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



13
# File 'lib/cql/model_dsl.rb', line 13

alias_method :original_initialize, :initialize