Module: Chewy::Index::Witchcraft::ClassMethods
- Defined in:
- lib/chewy/index/witchcraft.rb
Instance Method Summary collapse
- #cauldron(**options) ⇒ Object
- #check_requirements! ⇒ Object
- #witchcraft! ⇒ Object
- #witchcraft? ⇒ Boolean
Instance Method Details
#cauldron(**options) ⇒ Object
56 57 58 |
# File 'lib/chewy/index/witchcraft.rb', line 56 def cauldron(**) (@cauldron ||= {})[] ||= Cauldron.new(self, **) end |
#check_requirements! ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/chewy/index/witchcraft.rb', line 38 def check_requirements! = [] << "MethodSource gem is required for the Witchcraft, please add `gem 'method_source'` to your Gemfile" unless Proc.method_defined?(:source) if RUBY_VERSION >= '3.3' << "Prism gem is required for the Witchcraft, please add `gem 'prism'` to your Gemfile" unless '::Prism'.safe_constantize else << "Parser gem is required for the Witchcraft, please add `gem 'parser'` to your Gemfile" unless '::Parser'.safe_constantize end << "Unparser gem is required for the Witchcraft, please add `gem 'unparser'` to your Gemfile" unless '::Unparser'.safe_constantize = .join("\n") raise if .present? end |
#witchcraft! ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/chewy/index/witchcraft.rb', line 26 def witchcraft! warn( '[DEPRECATION] Chewy::Index.witchcraft! is deprecated and will be removed in a future release. ' \ 'The compiled compose path is now the default and delivers equivalent performance without ' \ "method_source/parser/unparser dependencies. Remove the `witchcraft!` call from #{name || self}.", uplevel: 1 ) Witchcraft.load_dependencies! self._witchcraft = true check_requirements! end |
#witchcraft? ⇒ Boolean
52 53 54 |
# File 'lib/chewy/index/witchcraft.rb', line 52 def witchcraft? !!_witchcraft end |