Class: TrueRandom::Random
- Inherits:
-
Object
- Object
- TrueRandom::Random
- Defined in:
- lib/true-random.rb
Instance Method Summary collapse
-
#initialize ⇒ Random
constructor
A new instance of Random.
- #integer(n = 1, min = 1, max = 100, base = 10) ⇒ Object
- #proxy(url = false, port = 8080) ⇒ Object
- #quota(ip = false) ⇒ Object
- #sequence(min = 1, max = 100) ⇒ Object
- #string(n = 1, len = 20, digits = true, upperalpha = true, loweralpha = true, unique = true) ⇒ Object
Constructor Details
#initialize ⇒ Random
Returns a new instance of Random.
5 6 7 |
# File 'lib/true-random.rb', line 5 def initialize @proxy_url = false end |
Instance Method Details
#integer(n = 1, min = 1, max = 100, base = 10) ⇒ Object
9 10 11 |
# File 'lib/true-random.rb', line 9 def integer n=1, min=1, max=100, base = 10 return integers "integers/?num=#{n}&min=#{min}&max=#{max}&col=1&base=#{base}" end |
#proxy(url = false, port = 8080) ⇒ Object
29 30 31 32 |
# File 'lib/true-random.rb', line 29 def proxy url = false, port = 8080 @proxy_url = url @proxy_port = port end |
#quota(ip = false) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/true-random.rb', line 21 def quota ip = false if ip return integers "quota/?" else return integers "quota/?ip=#{ip}" end end |
#sequence(min = 1, max = 100) ⇒ Object
13 14 15 |
# File 'lib/true-random.rb', line 13 def sequence min=1, max=100 return integers "sequences/?min=#{min}&max=#{max}&col=1" end |
#string(n = 1, len = 20, digits = true, upperalpha = true, loweralpha = true, unique = true) ⇒ Object
17 18 19 |
# File 'lib/true-random.rb', line 17 def string n = 1, len = 20, digits = true, upperalpha = true, loweralpha = true, unique = true return strings "strings/?num=#{n}&len=#{len}&digits=#{on_off digits}&upperalpha=#{on_off upperalpha}&loweralpha=#{on_off loweralpha}&unique=#{on_off unique}" end |