Module: Eson::More::Transplant::Functions
- Defined in:
- lib/eson/more/transplant.rb
Class Method Summary collapse
- .extract_ids(*args) ⇒ Object
- .get_children(client, parent) ⇒ Object
- .get_doc(client, parent, doc) ⇒ Object
Class Method Details
.extract_ids(*args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/eson/more/transplant.rb', line 5 def self.extract_ids(*args) args.map do |d| case d when String, Fixnum d when Hash d[:id] || d["id"] when nil d else d.id end end end |
.get_children(client, parent) ⇒ Object
31 32 33 |
# File 'lib/eson/more/transplant.rb', line 31 def self.get_children(client, parent) client.all(:type => nil, :q => "_parent:#{parent}",:routing => parent) end |
.get_doc(client, parent, doc) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/eson/more/transplant.rb', line 20 def self.get_doc(client, old_parent, doc) case doc when Hash doc when String client.get(:id => doc) else doc.to_h end end |