Class: Gricer::Mongoid::Agent

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Statistics, Mongoid::Document, Mongoid::Timestamps
Defined in:
app/models/gricer/mongoid/agent.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ActiveModel::Statistics

included, #model_type

Class Method Details

.browsersMongoid::Criteria

Filter out anything that is not a Browser or MobileBrowser

Returns:

  • (Mongoid::Criteria)


29
30
31
# File 'app/models/gricer/mongoid/agent.rb', line 29

def self.browsers
  self.any_in(agent_class: [:browser, :mobile_browser])
end

Instance Method Details

#calculate_agent_infoObject



33
34
35
36
# File 'app/models/gricer/mongoid/agent.rb', line 33

def calculate_agent_info    
  return if request_header.blank?
  self.attributes = Gricer::Parsers::Agent.get_info request_header
end