Sha256: d196a90efbd6967acc0df54222b214e2315c32b38a2ac640ea1e37350af9e1c1

Contents?: true

Size: 597 Bytes

Versions: 9

Compression:

Stored size: 597 Bytes

Contents

module Picky
  module Sinatra
      
    module IndexActions
      
      def self.extended base
        base.post '/' do
          index_name = params['index']
          index = Picky::Indexes[index_name.to_sym]
          data = params['data']
          index.replace_from Yajl::Parser.parse(data) if data
        end
        base.delete '/' do
          index_name = params['index']
          index = Picky::Indexes[index_name.to_sym]
          data = Yajl::Parser.parse params['data']
          id = data['id']
          index.remove id if id
        end
      end
      
    end
    
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
picky-4.3.0 lib/picky/sinatra/index_actions.rb
picky-4.2.4 lib/picky/sinatra/index_actions.rb
picky-4.2.3 lib/picky/sinatra/index_actions.rb
picky-4.2.2 lib/picky/sinatra/index_actions.rb
picky-4.2.1 lib/picky/sinatra/index_actions.rb
picky-4.2.0 lib/picky/sinatra/index_actions.rb
picky-4.1.0 lib/picky/sinatra/index_actions.rb
picky-4.0.9 lib/picky/sinatra/index_actions.rb
picky-4.0.8 lib/picky/sinatra/index_actions.rb