forgery_ja 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,137 @@
1
+ # coding: utf-8
2
+ class UnicodeSymbol
3
+ BLACK_SUN_WITH_RAYS = "\u{2600}"
4
+ CLOUD = "\u{2601}"
5
+ UMBRELLA_WITH_RAIN_DROPS = "\u{2614}"
6
+ SNOWMAN_WITHOUT_SNOW = "\u{26C4}"
7
+ HIGH_VOLTAGE_SIGN = "\u{26A1}"
8
+ CYCLONE = "\u{1F300}"
9
+ FOGGY = "\u{1F301}"
10
+ CLOSED_UMBRELLA = "\u{1F302}"
11
+ NIGHT_WITH_STARS = "\u{1F303}"
12
+ SUNRISE_OVER_MOUNTAINS = "\u{1F304}"
13
+ SUNRISE = "\u{1F305}"
14
+ CITYSCAPE_AT_DUSK = "\u{1F306}"
15
+ SUNSET_OVER_BUILDINGS = "\u{1F307}"
16
+ RAINBOW = "\u{1F308}"
17
+ SNOWFLAKE = "\u{2744}"
18
+ SUN_BEHIND_CLOUD = "\u{26C5}"
19
+ BRIDGE_AT_NIGHT = "\u{1F309}"
20
+ WATER_WAVE = "\u{1F30A}"
21
+ VOLCANO = "\u{1F30B}"
22
+ MILKY_WAY = "\u{1F30C}"
23
+ EARTH_GLOBE_ASIA_AUSTRALIA = "\u{1F30F}"
24
+ NEW_MOON_SYMBOL = "\u{1F311}"
25
+ WAXING_GIBBOUS_MOON_SYMBOL = "\u{1F314}"
26
+ FIRST_QUARTER_MOON_SYMBOL = "\u{1F313}"
27
+ CRESCENT_MOON = "\u{1F319}"
28
+ FULL_MOON_SYMBOL = "\u{1F315}"
29
+ FIRST_QUARTER_MOON_WITH_FACE = "\u{1F31B}"
30
+ GLOWING_STAR = "\u{1F31F}"
31
+ SHOOTING_STAR = "\u{1F320}"
32
+ CLOCK_FACE_ONE_OCLOCK = "\u{1F550}"
33
+ CLOCK_FACE_TWO_OCLOCK = "\u{1F551}"
34
+ CLOCK_FACE_THREE_OCLOCK = "\u{1F552}"
35
+ CLOCK_FACE_FOUR_OCLOCK = "\u{1F553}"
36
+ CLOCK_FACE_FIVE_OCLOCK = "\u{1F554}"
37
+ CLOCK_FACE_SIX_OCLOCK = "\u{1F555}"
38
+ CLOCK_FACE_SEVEN_OCLOCK = "\u{1F556}"
39
+ CLOCK_FACE_EIGHT_OCLOCK = "\u{1F557}"
40
+ CLOCK_FACE_NINE_OCLOCK = "\u{1F558}"
41
+ CLOCK_FACE_TEN_OCLOCK = "\u{1F559}"
42
+ CLOCK_FACE_ELEVEN_OCLOCK = "\u{1F55A}"
43
+ CLOCK_FACE_TWELVE_OCLOCK = "\u{1F55B}"
44
+ WATCH = "\u{231A}"
45
+ HOURGLASS = "\u{231B}"
46
+ ALARM_CLOCK = "\u{23F0}"
47
+ HOURGLASS_WITH_FLOWING_SAND = "\u{23F3}"
48
+ ARIES = "\u{2648}"
49
+ TAURUS = "\u{2649}"
50
+ GEMINI = "\u{264A}"
51
+ CANCER = "\u{264B}"
52
+ LEO = "\u{264C}"
53
+ VIRGO = "\u{264D}"
54
+ LIBRA = "\u{264E}"
55
+ SCORPIUS = "\u{264F}"
56
+ SAGITTARIUS = "\u{2650}"
57
+ CAPRICORN = "\u{2651}"
58
+ AQUARIUS = "\u{2652}"
59
+ PISCES = "\u{2653}"
60
+ OPHIUCHUS = "\u{26CE}"
61
+ FOUR_LEAF_CLOVER = "\u{1F340}"
62
+ TULIP = "\u{1F337}"
63
+ SEEDLING = "\u{1F331}"
64
+ MAPLE_LEAF = "\u{1F341}"
65
+ CHERRY_BLOSSOM = "\u{1F338}"
66
+ ROSE = "\u{1F339}"
67
+ FALLEN_LEAF = "\u{1F342}"
68
+ LEAF_FLUTTERING_IN_WIND = "\u{1F343}"
69
+ HIBISCUS = "\u{1F33A}"
70
+ SUNFLOWER = "\u{1F33B}"
71
+ PALM_TREE = "\u{1F334}"
72
+ CACTUS = "\u{1F335}"
73
+ EAR_OF_RICE = "\u{1F33E}"
74
+ EAR_OF_MAIZE = "\u{1F33D}"
75
+ MUSHROOM = "\u{1F344}"
76
+ CHESTNUT = "\u{1F330}"
77
+ BLOSSOM = "\u{1F33C}"
78
+ HERB = "\u{1F33F}"
79
+ CHERRIES = "\u{1F352}"
80
+ BANANA = "\u{1F34C}"
81
+ RED_APPLE = "\u{1F34E}"
82
+ TANGERINE = "\u{1F34A}"# Docomo NG
83
+ STRAWBERRY = "\u{1F353}"# Docomo NG
84
+ WATERMELON = "\u{1F349}"# Docomo NG
85
+ TOMATO = "\u{1F345}"# Docomo NG
86
+ AUBERGINE = "\u{1F346}" # Docomo NG
87
+ MELON = "\u{1F348}"# Docomo NG Softbank NG
88
+ PINEAPPLE = "\u{1F34D}"# Docomo NG Softbank NG
89
+ GRAPES = "\u{1F347}"# Docomo NG Softbank NG
90
+ PEACH = "\u{1F351}"# Docomo NG Softbank NG
91
+ GREEN_APPLE = "\u{1F34F}"
92
+ EYES = "\u{1F440}"
93
+ EAR = "\u{1F442}"
94
+ NOSE = "\u{1F443}"# Docomo NG
95
+ MOUTH = "\u{1F444}"
96
+ TONGUE = "\u{1F445}"
97
+ LIPSTICK = "\u{1F484}"
98
+ NAIL_POLISH = "\u{1F485}"# Docomo NG
99
+ FACE_MASSAGE = "\u{1F486}"# Docomo NG
100
+ HAIRCUT = "\u{1F487}"
101
+ BARBER_POLE = "\u{1F488}"# Docomo NG
102
+ BUST_IN_SILHOUETTE = "\u{1F464}"# Au NG Softbank NG
103
+ BOY = "\u{1F466}"
104
+ GIRL = "\u{1F467}"
105
+ MAN = "\u{1F468}"
106
+ WOMAN = "\u{1F469}"
107
+ FAMILY = "\u{1F46A}"# Docomo NG Softbank NG
108
+ MAN_AND_WOMAN_HOLDING_HANDS = "\u{1F46B}"# Docomo NG Au NG
109
+ POLICE_OFFICER = "\u{1F46E}"
110
+ WOMAN_WITH_BUNNY_EARS = "\u{1F46F}"
111
+ BRIDE_WITH_VEIL = "\u{1F470}"# Docomo NG Softbank NG
112
+ PERSON_WITH_BLOND_HAIR = "\u{1F471}"
113
+ MAN_WITH_GUA_PI_MAO = "\u{1F472}"
114
+ MAN_WITH_TURBAN = "\u{1F473}"
115
+ OLDER_MAN = "\u{1F474}"
116
+ OLDER_WOMAN = "\u{1F475}"
117
+ BABY = "\u{1F476}"
118
+ CONSTRUCTION_WORKER = "\u{1F477}"
119
+ PRINCESS = "\u{1F478}"
120
+ JAPANESE_OGRE = "\u{1F479}"
121
+ JAPANESE_GOBLIN = "\u{1F47A}"
122
+ GHOST = "\u{1F47B}"
123
+ BABY_ANGEL = "\u{1F47C}"
124
+ EXTRATERRESTRIAL_ALIEN = "\u{1F47D}"
125
+ ALIEN_MONSTER = "\u{1F47E}"
126
+ IMP = "\u{1F47F}"
127
+ SKULL = "\u{1F480}"
128
+ INFORMATION_DESK_PERSON = "\u{1F481}"
129
+ GUARDSMAN = "\u{1F482}"
130
+ DANCER = "\u{1F483}"
131
+ SNAIL = "\u{1F40C}"
132
+ SNAKE = "\u{1F40D}"
133
+ HORSE = "\u{1F40E}"
134
+ CHICKEN = "\u{1F414}"
135
+ CACTUS = "\u{1F335}"
136
+ end
137
+
@@ -3,6 +3,10 @@ require 'forgery_ja/forgery_ja'
3
3
  require 'forgery_ja/version'
4
4
  require 'forgery_ja/constant'
5
5
  require 'forgery_ja/forgery_ja_api'
6
+ require 'emoji/docomo'
7
+ require 'emoji/kddi'
8
+ require 'emoji/softbank'
9
+ require 'emoji/google'
6
10
 
7
11
  current_path = File.expand_path(File.dirname(__FILE__)) + '/'
8
12
  Dir[current_path + 'forgery_ja/forgery_ja/**/*.rb'].uniq.each do |file|
@@ -12,3 +16,4 @@ end
12
16
  ForgeryJa.load_from! "#{current_path}/forgery_ja/"
13
17
  #ForgeryJa.load_from! "#{ForgeryJa.rails_root}/lib/forgery" if Forgery.rails? && Rails::VERSION::STRING < "3.0.0"
14
18
  #require 'forgery_ja/forgery_ja_railtie' if ForgeryJa.rails? && Rails::VERSION::STRING >= "3.0.0"
19
+
@@ -0,0 +1,8 @@
1
+ 210.153.84.0/24
2
+ 210.136.161.0/24
3
+ 210.153.86.0/24
4
+ 124.146.174.0/24
5
+ 124.146.175.0/24
6
+ 202.229.176.0/24
7
+ 202.229.177.0/24
8
+ 202.229.178.0/24
@@ -0,0 +1,176 @@
1
+ F89F,0xE63E
2
+ F8A0,0xE63F
3
+ F8A1,0xE640
4
+ F8A2,0xE641
5
+ F8A3,0xE642
6
+ F8A4,0xE643
7
+ F8A5,0xE644
8
+ F8A6,0xE645
9
+ F8A7,0xE646
10
+ F8A8,0xE647
11
+ F8A9,0xE648
12
+ F8AA,0xE649
13
+ F8AB,0xE64A
14
+ F8AC,0xE64B
15
+ F8AD,0xE64C
16
+ F8AE,0xE64D
17
+ F8AF,0xE64E
18
+ F8B0,0xE64F
19
+ F8B1,0xE650
20
+ F8B2,0xE651
21
+ F8B3,0xE652
22
+ F8B4,0xE653
23
+ F8B5,0xE654
24
+ F8B6,0xE655
25
+ F8B7,0xE656
26
+ F8B8,0xE657
27
+ F8B9,0xE658
28
+ F8BA,0xE659
29
+ F8BB,0xE65A
30
+ F8BC,0xE65B
31
+ F8BD,0xE65C
32
+ F8BE,0xE65D
33
+ F8BF,0xE65E
34
+ F8C0,0xE65F
35
+ F8C1,0xE660
36
+ F8C2,0xE661
37
+ F8C3,0xE662
38
+ F8C4,0xE663
39
+ F8C5,0xE664
40
+ F8C6,0xE665
41
+ F8C7,0xE666
42
+ F8C8,0xE667
43
+ F8C9,0xE668
44
+ F8CA,0xE669
45
+ F8CB,0xE66A
46
+ F8CC,0xE66B
47
+ F8CD,0xE66C
48
+ F8CE,0xE66D
49
+ F8CF,0xE66E
50
+ F8D0,0xE66F
51
+ F8D1,0xE670
52
+ F8D2,0xE671
53
+ F8D3,0xE672
54
+ F8D4,0xE673
55
+ F8D5,0xE674
56
+ F8D6,0xE675
57
+ F8D7,0xE676
58
+ F8D8,0xE677
59
+ F8D9,0xE678
60
+ F8DA,0xE679
61
+ F8DB,0xE67A
62
+ F8DC,0xE67B
63
+ F8DD,0xE67C
64
+ F8DE,0xE67D
65
+ F8DF,0xE67E
66
+ F8E0,0xE67F
67
+ F8E1,0xE680
68
+ F8E2,0xE681
69
+ F8E3,0xE682
70
+ F8E4,0xE683
71
+ F8E5,0xE684
72
+ F8E6,0xE685
73
+ F8E7,0xE686
74
+ F8E8,0xE687
75
+ F8E9,0xE688
76
+ F8EA,0xE689
77
+ F8EB,0xE68A
78
+ F8EC,0xE68B
79
+ F8ED,0xE68C
80
+ F8EE,0xE68D
81
+ F8EF,0xE68E
82
+ F8F0,0xE68F
83
+ F8F1,0xE690
84
+ F8F2,0xE691
85
+ F8F3,0xE692
86
+ F8F4,0xE693
87
+ F8F5,0xE694
88
+ F8F6,0xE695
89
+ F8F7,0xE696
90
+ F8F8,0xE697
91
+ F8F9,0xE698
92
+ F8FA,0xE699
93
+ F8FB,0xE69A
94
+ F8FC,0xE69B
95
+ F940,0xE69C
96
+ F941,0xE69D
97
+ F942,0xE69E
98
+ F943,0xE69F
99
+ F944,0xE6A0
100
+ F945,0xE6A1
101
+ F946,0xE6A2
102
+ F947,0xE6A3
103
+ F948,0xE6A4
104
+ F949,0xE6A5
105
+ F972,0xE6CE
106
+ F973,0xE6CF
107
+ F974,0xE6D0
108
+ F975,0xE6D1
109
+ F976,0xE6D2
110
+ F977,0xE6D3
111
+ F978,0xE6D4
112
+ F979,0xE6D5
113
+ F97A,0xE6D6
114
+ F97B,0xE6D7
115
+ F97C,0xE6D8
116
+ F97D,0xE6D9
117
+ F97E,0xE6DA
118
+ F980,0xE6DB
119
+ F981,0xE6DC
120
+ F982,0xE6DD
121
+ F983,0xE6DE
122
+ F984,0xE6DF
123
+ F985,0xE6E0
124
+ F986,0xE6E1
125
+ F987,0xE6E2
126
+ F988,0xE6E3
127
+ F989,0xE6E4
128
+ F98A,0xE6E5
129
+ F98B,0xE6E6
130
+ F98C,0xE6E7
131
+ F98D,0xE6E8
132
+ F98E,0xE6E9
133
+ F98F,0xE6EA
134
+ F990,0xE6EB
135
+ F9B0,0xE70B
136
+ F991,0xE6EC
137
+ F992,0xE6ED
138
+ F993,0xE6EE
139
+ F994,0xE6EF
140
+ F995,0xE6F0
141
+ F996,0xE6F1
142
+ F997,0xE6F2
143
+ F998,0xE6F3
144
+ F999,0xE6F4
145
+ F99A,0xE6F5
146
+ F99B,0xE6F6
147
+ F99C,0xE6F7
148
+ F99D,0xE6F8
149
+ F99E,0xE6F9
150
+ F99F,0xE6FA
151
+ F9A0,0xE6FB
152
+ F9A1,0xE6FC
153
+ F9A2,0xE6FD
154
+ F9A3,0xE6FE
155
+ F9A4,0xE6FF
156
+ F9A5,0xE700
157
+ F9A6,0xE701
158
+ F9A7,0xE702
159
+ F9A8,0xE703
160
+ F9A9,0xE704
161
+ F9AA,0xE705
162
+ F9AB,0xE706
163
+ F9AC,0xE707
164
+ F9AD,0xE708
165
+ F9AE,0xE709
166
+ F9AF,0xE70A
167
+ F950,0xE6AC
168
+ F951,0xE6AD
169
+ F952,0xE6AE
170
+ F955,0xE6B1
171
+ F956,0xE6B2
172
+ F957,0xE6B3
173
+ F95B,0xE6B7
174
+ F95C,0xE6B8
175
+ F95D,0xE6B9
176
+ F95E,0xE6BA
@@ -0,0 +1,42 @@
1
+ 210.230.128.224/28
2
+ 121.111.227.160/27
3
+ 61.117.1.0/28
4
+ 219.108.158.0/27
5
+ 219.125.146.0/28
6
+ 61.117.2.32/29
7
+ 61.117.2.40/29
8
+ 219.108.158.40/29
9
+ 219.125.148.0/25
10
+ 222.5.63.0/25
11
+ 222.5.63.128/25
12
+ 222.5.62.128/25
13
+ 59.135.38.128/25
14
+ 219.108.157.0/25
15
+ 219.125.145.0/25
16
+ 121.111.231.0/25
17
+ 121.111.227.0/25
18
+ 118.152.214.192/26
19
+ 118.159.131.0/25
20
+ 118.159.133.0/25
21
+ 118.159.132.160/27
22
+ 111.86.142.0/26
23
+ 111.86.141.64/26
24
+ 111.86.141.128/26
25
+ 111.86.141.192/26
26
+ 118.159.133.192/26
27
+ 111.86.143.192/27
28
+ 111.86.143.224/27
29
+ 111.86.147.0/27
30
+ 111.86.142.128/27
31
+ 111.86.142.160/27
32
+ 111.86.142.192/27
33
+ 111.86.142.224/27
34
+ 111.86.143.0/27
35
+ 111.86.143.32/27
36
+ 111.86.147.32/27
37
+ 111.86.147.64/27
38
+ 111.86.147.96/27
39
+ 111.86.147.128/27
40
+ 111.86.147.160/27
41
+ 111.86.147.192/27
42
+ 111.86.147.224/27
@@ -0,0 +1,3 @@
1
+ 123.108.237.0/27
2
+ 202.253.96.224/27
3
+ 210.146.7.192/26
@@ -16,7 +16,7 @@ class ForgeryJa::Address < Forgery::Address
16
16
  format = ( options[:hyphen] ? "###-####" : "#######" )
17
17
  format.to_numbers
18
18
  end
19
-
19
+
20
20
  # Returns StateName in Japanese
21
21
  # 都道府県名を返します
22
22
  #
@@ -100,10 +100,10 @@ class ForgeryJa::Address < Forgery::Address
100
100
  result = list[:state] if list[:state]
101
101
  result = list_merge(result, list[:city], options[:blank])
102
102
  result = list_merge(result, list[:street], options[:blank])
103
- result.collect!{|f| options[:blank] ? f + " " + list[:number] : f + list[:number] } if list[:number]
103
+ result.collect!{|f| f + (options[:blank] ? ' ':'') + list[:number] } if list[:number]
104
104
  options[:to] == ForgeryJa::ARRAY ? result : result[options[:to]]
105
105
  end
106
-
106
+
107
107
  # Returns AddressList in Japanese
108
108
  # 日本語の住所のリストを生成して返します
109
109
  #
@@ -125,21 +125,17 @@ class ForgeryJa::Address < Forgery::Address
125
125
  list[:number] = street_number if options[:number]
126
126
  list
127
127
  end
128
-
128
+
129
129
  private
130
130
  # Arrayの各列をmergeします
131
131
  #
132
132
  # @example
133
133
  # list_merge(['x', 'y'], ['1', '2'], true)
134
134
  # # => ['x 1', 'y 2']
135
- def self.list_merge(target, data, blank)
135
+ def self.list_merge(target, data, blank=true)
136
136
  return data if target.size == 0
137
137
  return target if data.size == 0
138
-
139
- data.each_with_index do |f,i|
140
- target[i] << " " if blank
141
- target[i] << f
142
- end
143
- target
138
+ target.zip(data).map{|f| f.join blank ? ' ' : ''}
144
139
  end
145
140
  end
141
+
@@ -0,0 +1,139 @@
1
+ # coding: utf-8
2
+
3
+ class ForgeryJa::Mobile < ForgeryJa
4
+ # Return Unicode Emoji
5
+ # optionsで指定したキャリアの絵文字をUnicodeで返します
6
+ # @param [Hash] options キャリア指定
7
+ # @option options [boolean] :docomo (true) Docomo絵文字を返すかどうか
8
+ # @option options [boolean] :kddi (true) Kddi絵文字を返すかどうか
9
+ # @option options [boolean] :softbank (true) Softbank絵文字を返すかどうか
10
+ # @option options [boolean] :google (false) Google絵文字を返すかどうか
11
+ # @return [String] Unicode絵文字
12
+ def self.emoji_unicode(options={})
13
+ options = { :docomo => true, :kddi => true, :softbank => true, :google => false }.merge(options)
14
+ list = []
15
+ list << emoji_docomo_unicode if options[:docomo]
16
+ list << emoji_kddi_unicode if options[:kddi]
17
+ list << emoji_softbank_unicode if options[:softbank]
18
+ list << emoji_google_unicode if options[:google]
19
+ list.random
20
+ end
21
+
22
+ # Return Sjis Emoji
23
+ # optionsで指定したキャリアの絵文字をSjisで返します
24
+ # @param [Hash] options キャリア指定
25
+ # @option options [boolean] :docomo (true) Docomo絵文字を返すかどうか
26
+ # @option options [boolean] :kddi (true) Kddi絵文字を返すかどうか
27
+ # @option options [boolean] :softbank (true) Softbank絵文字を返すかどうか
28
+ # @return [String] Sjis絵文字
29
+ def self.emoji_sjis(options={})
30
+ options = { :docomo => true, :kddi => true, :softbank => true }.merge(options)
31
+ list = []
32
+ list << emoji_docomo_sjis if options[:docomo]
33
+ list << emoji_kddi_sjis if options[:kddi]
34
+ list << emoji_softbank_sjis if options[:softbank]
35
+ list.random
36
+ end
37
+
38
+ # Returns Mobile Phone Number in Japaneses
39
+ # 携帯電話番号を返します
40
+ # @param [Hash] options
41
+ # @option options [boolean] :hyphen (true) ハイフンを含めるかどうか
42
+ # @return [String]
43
+ def self.phone_number(options={})
44
+ options = {:hyphen => true}.merge(options)
45
+ format = ( options[:hyphen] ? "-####-####" : "########" )
46
+ ["090", "080", "070"].random + format.to_numbers
47
+ end
48
+
49
+ # Returns Mobile IP
50
+ # 携帯電話から接続する際のIPアドレスを返します
51
+ # @param [Hash] options キャリア指定
52
+ # @option options [boolean] :docomo (true) DocomoのIPを返すかどうか
53
+ # @option options [boolean] :kddi (true) KddiのIPを返すかどうか
54
+ # @option options [boolean] :softbank (true) SoftbankのIPを返すかどうか
55
+ # @return [String] ipアドレス
56
+ # @example
57
+ # ForgeryJa(:mobile).ip
58
+ # # => 124.146.175.254
59
+ def self.ip(options={})
60
+ options = { :docomo => true, :kddi => true, :softbank => true }.merge(options)
61
+ list = []
62
+ list << docomo_ip if options[:docomo]
63
+ list << kddi_ip if options[:kddi]
64
+ list << softbank_ip if options[:softbank]
65
+ list.random
66
+ end
67
+
68
+ # Docomoの絵文字をUnicodeで返します
69
+ def self.emoji_docomo_unicode
70
+ Emoji::Docomo.list.random
71
+ end
72
+
73
+ # Docomoの絵文字をSjisで返します
74
+ def self.emoji_docomo_sjis
75
+ emoji_docomo_unicode.encode("SJIS-DOCOMO")
76
+ end
77
+
78
+ # Kddiの絵文字をUnicodeで返します
79
+ def self.emoji_kddi_unicode
80
+ Emoji::Kddi.list.random
81
+ end
82
+
83
+ # Kddiの絵文字をSjisで返します
84
+ def self.emoji_kddi_sjis
85
+ emoji_kddi_unicode.encode("SJIS-KDDI")
86
+ end
87
+
88
+ # Softbankの絵文字をUnicodeで返します
89
+ def self.emoji_softbank_unicode
90
+ Emoji::Softbank.list.random
91
+ end
92
+
93
+ # Softbankの絵文字をSjisで返します
94
+ def self.emoji_softbank_sjis
95
+ emoji_softbank_unicode.encode("SJIS-SOFTBANK")
96
+ end
97
+
98
+ # Googleの絵文字をUnicodeで返します
99
+ def self.emoji_google_unicode
100
+ Emoji::Google.list.random
101
+ end
102
+
103
+ # DocomoのIPアドレスを返します
104
+ # 返すIPはimode接続時のIPとなります
105
+ # フルブラウザの場合は異なるIPとなるようです
106
+ # @see http://www.nttdocomo.co.jp/service/imode/make/content/ip/index.html
107
+ def self.docomo_ip
108
+ calc_ip( dictionaries[:docomo_ip].random ).join "."
109
+ end
110
+
111
+ # Kddiからの接続時のIPアドレスを返します
112
+ # 返すIPは EZweb接続時のIPとなります
113
+ # PCサイトビューアー(PCSV)の際には異なるIPとなります
114
+ # 2011年7月にリストが増えるようです
115
+ # @see http://www.au.kddi.com/ezfactory/tec/spec/ezsava_ip.html
116
+ def self.kddi_ip
117
+ calc_ip( dictionaries[:kddi_ip].random ).join "."
118
+ end
119
+
120
+ # Softbankからの接続時のIPアドレスを返します
121
+ # 返すIPは Yahoo!ケータイからの接続時のIPとなります
122
+ # PCサイトブラウザのIPアドレスは異なります
123
+ # SSL接続時の仕様が変わるようです(http://creation.mb.softbank.jp/web/web_ssl.html)
124
+ # @see http://creation.mb.softbank.jp/web/web_ip.html
125
+ def self.softbank_ip
126
+ calc_ip( dictionaries[:softbank_ip].random ).join "."
127
+ end
128
+
129
+ private
130
+ def self.calc_ip(ip)
131
+ ip_array = ip.split "."
132
+ # 最大で254
133
+ s = ( 2 ** ( 32 - ip_array[3].split("/")[1].to_i ) ) - 2
134
+ # 1 - 254の間で第4オクテットを生成
135
+ ip_array[3] = (ip_array[3].to_i + (1 .. s).random).to_s
136
+ ip_array
137
+ end
138
+ end
139
+