Method: Flex::Result::Document#method_missing
- Defined in:
- lib/flex/result/document.rb
#method_missing(meth, *args, &block) ⇒ Object
exposes _source and readers: automatically supply object-like reader access also expose meta readers like _id, _source, etc, also callable without the leading ‘_’
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/flex/result/document.rb', line 31 def method_missing(meth, *args, &block) smeth = meth.to_s case # field name when readers.has_key?(smeth) readers[smeth] # result item when has_key?(smeth) self[smeth] # result item called without the '_' prefix when has_key?("_#{smeth}") self["_#{smeth}"] else super end end |