Module: Tire::DSL
- Included in:
- Tire
- Defined in:
- lib/tire/dsl.rb
Instance Method Summary collapse
- #aliases ⇒ Object
- #configure(&block) ⇒ Object
- #index(name, &block) ⇒ Object
- #scan(names, options = {}, &block) ⇒ Object
- #search(indices = nil, options = {}, &block) ⇒ Object
Instance Method Details
#configure(&block) ⇒ Object
4 5 6 |
# File 'lib/tire/dsl.rb', line 4 def configure(&block) Configuration.class_eval(&block) end |
#index(name, &block) ⇒ Object
30 31 32 |
# File 'lib/tire/dsl.rb', line 30 def index(name, &block) Index.new(name, &block) end |
#scan(names, options = {}, &block) ⇒ Object
34 35 36 |
# File 'lib/tire/dsl.rb', line 34 def scan(names, ={}, &block) Search::Scan.new(names, , &block) end |
#search(indices = nil, options = {}, &block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/tire/dsl.rb', line 8 def search(indices=nil, ={}, &block) if block_given? Search::Search.new(indices, , &block) else payload = case when Hash then when String then Tire.warn "Passing the payload as a JSON string in Tire.search has been deprecated, " + "please use the block syntax or pass a plain Hash." else raise ArgumentError, "Please pass a Ruby Hash or String with JSON" end Search::Search.new(indices, :payload => payload) end rescue Exception => error STDERR.puts "[REQUEST FAILED] #{error.class} #{error. rescue nil}\n" raise ensure end |