Class: Browser::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/h2ocube_rails_helper.rb

Direct Known Subclasses

Meta::Desktop, Meta::Tablet, Meta::Wechat

Instance Method Summary collapse

Instance Method Details

#desktop?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/h2ocube_rails_helper.rb', line 13

def desktop?
  !ua.blank? && !device.mobile? && !device.tablet?
end

#metaObject Also known as: to_a



17
18
19
20
21
22
# File 'lib/h2ocube_rails_helper.rb', line 17

def meta
  Meta.constants.each_with_object(Set.new) do |meta_name, meta|
    meta_class = Meta.const_get(meta_name)
    meta.merge(meta_class.new(self).to_a)
  end.to_a
end

#mobile?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/h2ocube_rails_helper.rb', line 9

def mobile?
  !ua.blank? && (device.mobile? || device.tablet?)
end

#wechat?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/h2ocube_rails_helper.rb', line 5

def wechat?
  !(ua =~ /MicroMessenger/i).nil?
end