Class: Jpmobile::Mobile::AbstractMobile

Inherits:
Object
  • Object
show all
Defined in:
lib/jpmobile/mobile/abstract_mobile.rb

Overview

?????????????????????????????????

Direct Known Subclasses

Au, Docomo, Emobile, Softbank, Willcom

Constant Summary

USER_AGENT_REGEXP =

????????????user-agent???????????????

nil
MAIL_ADDRESS_REGEXP =

????????????????????????????????????????????????

nil

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (AbstractMobile) initialize(request)

A new instance of AbstractMobile



6
7
8
# File 'lib/jpmobile/mobile/abstract_mobile.rb', line 6

def initialize(request)
  @request = request
end

Class Method Details

+ (Boolean) valid_ip?(remote_addr)

?????????????????????IP??????????????????????????????????????????????????? true ???????????? ????????????????????? false ???????????? IP?????????????????????????????????????????? nil ????????????

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
36
37
# File 'lib/jpmobile/mobile/abstract_mobile.rb', line 28

def self.valid_ip? remote_addr
  addrs = nil
  begin
    addrs = self::IP_ADDRESSES
  rescue NameError => e
    return nil
  end
  remote = IPAddr.new(remote_addr)
  addrs.any? {|ip| ip.include? remote }
end

Instance Method Details

- (Object) display

??????????????? Display ??????????????????????????????????????????



44
45
46
# File 'lib/jpmobile/mobile/abstract_mobile.rb', line 44

def display
  @__displlay ||= Jpmobile::Display.new
end

- (Object) ident

??????????????????????????????????????????????????????????????????



19
# File 'lib/jpmobile/mobile/abstract_mobile.rb', line 19

def ident; ident_subscriber || ident_device; end

- (Object) ident_device

???????????????????????????????????????????????????



23
# File 'lib/jpmobile/mobile/abstract_mobile.rb', line 23

def ident_device; nil; end

- (Object) ident_subscriber

??????????????????????????????????????????????????????



21
# File 'lib/jpmobile/mobile/abstract_mobile.rb', line 21

def ident_subscriber; nil; end

- (Object) position

???????????????????????? Position ?????????????????????????????????



16
# File 'lib/jpmobile/mobile/abstract_mobile.rb', line 16

def position; return nil; end

- (Boolean) supports_cookie?

?????????????????????????????????????????????

Returns:

  • (Boolean)


49
50
51
# File 'lib/jpmobile/mobile/abstract_mobile.rb', line 49

def supports_cookie?
  return false
end

- (Boolean) valid_ip?

Returns:

  • (Boolean)


39
40
41
# File 'lib/jpmobile/mobile/abstract_mobile.rb', line 39

def valid_ip?
  @__valid_ip ||= self.class.valid_ip? @request.remote_addr
end