Sha256: f656b0a975e93380b4666ba79118f3298e06e17ec898f2f1bc8f769c1a0c6381

Contents?: true

Size: 763 Bytes

Versions: 5

Compression:

Stored size: 763 Bytes

Contents

module Ratchetio
  module Rails
    module ControllerMethods
      include RequestDataExtractor

      def ratchetio_person_data
        user = send(Ratchetio.configuration.person_method)
        # include id, username, email if non-empty
        if user
          {
            :id => (user.send(Ratchetio.configuration.person_id_method) rescue nil),
            :username => (user.send(Ratchetio.configuration.person_username_method) rescue nil),
            :email => (user.send(Ratchetio.configuration.person_email_method) rescue nil)
          }
        else
          {}
        end
      rescue NoMethodError, NameError
        {}
      end

      def ratchetio_request_data
        extract_request_data_from_rack(request.env)
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ratchetio-0.7.1 lib/ratchetio/rails/controller_methods.rb
ratchetio-0.7.0 lib/ratchetio/rails/controller_methods.rb
ratchetio-0.6.3 lib/ratchetio/rails/controller_methods.rb
ratchetio-0.6.1 lib/ratchetio/rails/controller_methods.rb
ratchetio-0.6.0 lib/ratchetio/rails/controller_methods.rb