Sha256: a2ecd9c6d601cee2c3341b82b75faa9152b79e7aed2e587d0a419ac53ad0a736

Contents?: true

Size: 910 Bytes

Versions: 36

Compression:

Stored size: 910 Bytes

Contents

module Lolita
  module Processors
    class RequestProcessor

      attr_accessor :scope

      def self.respond_to(mapping,scope,action) 
        action_processor = "Lolita::Processors::RequestProcessor::#{action.to_s.camelize}ActionProcessor".constantize.new(mapping,scope)
        action_processor.respond
      end

      def initialize(mapping,scope)
        @mapping = mapping
        @scope = scope
      end

      def resource_class
        @scope.resource_class
      end

      class IndexActionProcessor < self

        def respond
          build_response = resource_class.lolita.list.build(:page => page)
          scope.instance_variable_set(:"@component_builder",build_response)
          scope.haml :"lolita/rest/index.html", :layout => :"layouts/lolita/application.html"
        end

        def page
          resource_class.lolita.list.paginate(1)
        end

      end

    end

  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
lolita-4.0.11 lib/lolita/processors/request_processor.rb
lolita-4.2.0 lib/lolita/processors/request_processor.rb
lolita-4.0.10 lib/lolita/processors/request_processor.rb
lolita-4.0.9 lib/lolita/processors/request_processor.rb
lolita-4.0.8 lib/lolita/processors/request_processor.rb
lolita-4.0.7 lib/lolita/processors/request_processor.rb
lolita-4.0.6 lib/lolita/processors/request_processor.rb
lolita-4.0.5 lib/lolita/processors/request_processor.rb
lolita-4.0.4 lib/lolita/processors/request_processor.rb
lolita-4.0.3 lib/lolita/processors/request_processor.rb
lolita-4.0.2 lib/lolita/processors/request_processor.rb
lolita-4.0.1 lib/lolita/processors/request_processor.rb
lolita-4.0.0 lib/lolita/processors/request_processor.rb
lolita-3.4.3 lib/lolita/processors/request_processor.rb
lolita-3.4.2 lib/lolita/processors/request_processor.rb
lolita-3.4.1 lib/lolita/processors/request_processor.rb
lolita-3.4.0 lib/lolita/processors/request_processor.rb
lolita-3.3.9 lib/lolita/processors/request_processor.rb
lolita-3.3.8 lib/lolita/processors/request_processor.rb
lolita-3.3.7 lib/lolita/processors/request_processor.rb