Module: AssayDepot::Model
- Defined in:
- lib/assaydepot/model.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(options = {}) ⇒ Object
- #initialize_copy(source) ⇒ Object
- #options(options = {}) ⇒ Object
- #private_results ⇒ Object
- #query_time ⇒ Object
- #total ⇒ Object
Class Method Details
.included(base) ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/assaydepot/model.rb', line 135 def self.included(base) base.extend ClassMethods base.extend Forwardable base.def_delegators :private_results, :each, :[], :count, :collect, :map, :tap, :<=>, :compact, :each_index, :each_with_index, :empty?, :flatten, :include?, :index, :length, :first, :last, :keep_if, :reject, :reverse attr_accessor :internal_options end |
Instance Method Details
#initialize(options = {}) ⇒ Object
163 164 165 |
# File 'lib/assaydepot/model.rb', line 163 def initialize(={}) @internal_options = [:search_options] || { } end |
#initialize_copy(source) ⇒ Object
167 168 169 170 171 |
# File 'lib/assaydepot/model.rb', line 167 def initialize_copy(source) super @search_query = @search_query.dup @search_facets = @search_facets.dup end |
#options(options = {}) ⇒ Object
181 182 183 184 185 |
# File 'lib/assaydepot/model.rb', line 181 def (={}) result = self.clone result. = self. ? self..merge() : result end |
#private_results ⇒ Object
187 188 189 |
# File 'lib/assaydepot/model.rb', line 187 def private_results internal_results[self.class.ref_name] end |
#query_time ⇒ Object
173 174 175 |
# File 'lib/assaydepot/model.rb', line 173 def query_time internal_results["query_time"] end |
#total ⇒ Object
177 178 179 |
# File 'lib/assaydepot/model.rb', line 177 def total internal_results["total"] end |