sixarm_ruby_date_time_rand 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d1d58c1c3af7ee30fb2c516446b28dd8bf011df2
4
+ data.tar.gz: 969fe0a9ddadd63c155dea602d32d5d1fec443a1
5
+ SHA512:
6
+ metadata.gz: 57d8ef46c45d18fcc8acf71349beef49c6575602b791178311197ca39483a068e81bbc63cf65d404226c50411079ec0bd6f6b46b142edfd8b651af602f84fa1e
7
+ data.tar.gz: ca64ff8070cfee3ae2e4c667f5b5be0380c2d1cba79ae14cffa948d77bcec1612494356a95cc5de409ab3775d1b3a4d09fcd873411520cd56b0f1de28177806c
checksums.yaml.gz.sig ADDED
Binary file
data/.gemtest ADDED
File without changes
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,28 @@
1
+ # Contributing
2
+
3
+ Thank you for contributing!
4
+
5
+ If you would like to contribute a donation, an easy way is to use PayPal to sixarm@sixarm.com.
6
+
7
+ If you would like to contribute help, the next section is for you.
8
+
9
+
10
+ ## Contributing to the source
11
+
12
+ We love pull requests for improvments to the source code and documentation.
13
+
14
+ There are three easy steps:
15
+
16
+ 1. Fork the repo.
17
+
18
+ * Before you do any work please run our existing tests to make sure the code runs cleanly.
19
+
20
+ 2. Work as you like.
21
+
22
+ * Please create tests. This helps us know that all your code runs cleanly.
23
+
24
+ 3. Push to your fork and submit a pull request.
25
+
26
+ * We'll take a look as soon as we can; this is typically within a business day.
27
+
28
+ Thank you again!
data/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # SixArm.com » Ruby » <br> Date and Time #rand methods
2
+
3
+ [![Code Climate](https://codeclimate.com/github/SixArm/sixarm_ruby_date_time_rand.png)](https://codeclimate.com/github/SixArm/sixarm_ruby_date_time_rand)
4
+ [![Build Status](https://travis-ci.org/SixArm/sixarm_ruby_date_time_rand.png)](https://travis-ci.org/SixArm/sixarm_ruby_date_time_rand)
5
+
6
+ * Doc: <http://sixarm.com/sixarm_ruby_date_time_rand/doc>
7
+ * Gem: <http://rubygems.org/gems/sixarm_ruby_date_time_rand>
8
+ * Repo: <http://github.com/sixarm/sixarm_ruby_date_time_rand>
9
+ * Email: Joel Parker Henderson, <joel@sixarm.com>
10
+
11
+
12
+ ## Introduction
13
+
14
+ Generate random dates and times:
15
+
16
+ DateTime.rand
17
+ Date.rand
18
+ Time.rand
19
+
20
+ The random range is +/- 10000 days.
21
+
22
+ For docs go to <http://sixarm.com/sixarm_ruby_date_time_rand/doc>
23
+
24
+ Want to help? We're happy to get pull requests.
25
+
26
+
27
+ ## Install quickstart
28
+
29
+ Install:
30
+
31
+ gem install sixarm_ruby_date_time_rand
32
+
33
+ Bundler:
34
+
35
+ gem "sixarm_ruby_date_time_rand", "~>2.0.0"
36
+
37
+ Require:
38
+
39
+ require "sixarm_ruby_date_time_rand"
40
+
41
+
42
+ ## Install with security (optional)
43
+
44
+ To enable high security for all our gems:
45
+
46
+ wget http://sixarm.com/sixarm.pem
47
+ gem cert --add sixarm.pem
48
+ gem sources --add http://sixarm.com
49
+
50
+ To install with high security:
51
+
52
+ gem install sixarm_ruby_date_time_rand --test --trust-policy HighSecurity
53
+
54
+
55
+ ## Changes
56
+
57
+ * 2014-03-26 2.0.0 Publish
58
+
59
+
60
+ ## License
61
+
62
+ You may choose any of these open source licenses:
63
+
64
+ * Apache License
65
+ * BSD License
66
+ * CreativeCommons License, Non-commercial Share Alike
67
+ * GNU General Public License Version 2 (GPL 2)
68
+ * GNU Lesser General Public License (LGPL)
69
+ * MIT License
70
+ * Perl Artistic License
71
+ * Ruby License
72
+
73
+ The software is provided "as is", without warranty of any kind,
74
+ express or implied, including but not limited to the warranties of
75
+ merchantability, fitness for a particular purpose and noninfringement.
76
+
77
+ In no event shall the authors or copyright holders be liable for any
78
+ claim, damages or other liability, whether in an action of contract,
79
+ tort or otherwise, arising from, out of or in connection with the
80
+ software or the use or other dealings in the software.
81
+
82
+ This license is for the included software that is created by SixArm;
83
+ some of the included software may have its own licenses, copyrights,
84
+ authors, etc. and these do take precedence over the SixArm license.
85
+
86
+ Copyright (c) 2005-2012 Joel Parker Henderson
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'lib' << 'test'
7
+ t.pattern = 'test/*.rb'
8
+ end
9
+
10
+ task :default => [:test]
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.0.0
@@ -0,0 +1,34 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'date'
4
+
5
+ # Date extensions
6
+
7
+ class Date
8
+
9
+ # @return [Date] a random daate
10
+ #
11
+ # This calls `DateTime#rand`.
12
+ #
13
+ # The default range is +/- 10000 days from now.
14
+ # which is the same as `DateTime.rand` and `Time.rand`.
15
+ #
16
+ # @example
17
+ #
18
+ # Date.rand
19
+ # => "2014-12-31"
20
+ #
21
+ # @example with a range
22
+ #
23
+ # today = Date.today
24
+ # range = (today - 10000)..(today + 10000)
25
+ # Date.rand(range)
26
+ #
27
+ # @param [Range<Date..Dateb>] A range of potential dates, or nil for the default.
28
+ #
29
+ def self.rand(range = nil)
30
+ DateTime.rand(range).to_date
31
+ end
32
+
33
+ end
34
+
@@ -0,0 +1,33 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'date'
4
+
5
+ # DateTime extensions
6
+
7
+ class DateTime
8
+
9
+ # @return [DateTime] a random date-time
10
+ #
11
+ # This is called by `Date.rand` and `Time.rand`.
12
+ #
13
+ # The default range is +/- 10000 days from now,
14
+ # which is the same as `Date.rand` and `Time.rand`.
15
+ #
16
+ # @example
17
+ #
18
+ # DateTime.rand
19
+ # => "2014-12-31 12:59:59Z"
20
+ #
21
+ # @example with a range
22
+ #
23
+ # now = DateTime.now
24
+ # range = (now - 10000)..(now + 10000)
25
+ # DateTime.rand(range)
26
+ #
27
+ # @param [Range<DateTime..DateTime>] A range of potential date-times, or nil for the default range.
28
+ #
29
+ def self.rand(range = nil)
30
+ range ? Kernel.rand(range) : (DateTime.now + Kernel.rand(-10000..10000))
31
+ end
32
+
33
+ end
@@ -0,0 +1,33 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'time'
4
+
5
+ # Time extensions
6
+
7
+ class Time
8
+
9
+ # @return [Time] a random time
10
+ #
11
+ # This calls `DateTime.rand`.
12
+ #
13
+ # The default range is +/- 10000 days from now,
14
+ # which is the same as `Date.rand` and `DateTime.rand`.
15
+ #
16
+ # @example
17
+ #
18
+ # Time.rand
19
+ # => "2014-12-31 12:59:59Z"
20
+ #
21
+ # @example with a range
22
+ #
23
+ # now = Time.now
24
+ # range = (now - 10000)..(now + 10000)
25
+ # Time.rand(range)
26
+ #
27
+ # @param [Range<Time..Time>] A range of potential times, or nil for the default range.
28
+ #
29
+ def self.rand(range = nil)
30
+ DateTime.rand(range).to_time
31
+ end
32
+
33
+ end
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README
4
+ =end
5
+
6
+ ['date','date_time','time'].map{|x|
7
+ require File.dirname(__FILE__) + "/sixarm_ruby_date_time_rand/#{x}.rb"
8
+ }
@@ -0,0 +1,20 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
+ require 'sixarm_ruby_date_time_rand'
4
+
5
+ class DateTest < Minitest::Test
6
+
7
+ def test_rand
8
+ rand = Date.rand
9
+ assert_kind_of(Date, rand)
10
+ end
11
+
12
+ def test_rand_with_range
13
+ today = Date.today
14
+ range = (today - 1000)..(today + 1000)
15
+ rand = Date.rand(range)
16
+ assert_kind_of(Date, rand)
17
+ assert(range.begin <= rand && rand <= range.end)
18
+ end
19
+
20
+ end
@@ -0,0 +1,20 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
+ require 'sixarm_ruby_date_time_rand'
4
+
5
+ class DateTimeTest < Minitest::Test
6
+
7
+ def test_rand
8
+ rand = DateTime.rand
9
+ assert_kind_of(DateTime, rand)
10
+ end
11
+
12
+ def test_rand_with_range
13
+ now = DateTime.now
14
+ range = (now - 10)..(now + 10)
15
+ rand = DateTime.rand(range)
16
+ assert_kind_of(DateTime, rand)
17
+ assert(range.begin <= rand && rand <= range.end)
18
+ end
19
+
20
+ end
@@ -0,0 +1,21 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
+ require 'sixarm_ruby_date_time_rand'
4
+
5
+ class TimeTest < Minitest::Test
6
+
7
+ def test_rand
8
+ rand = Time.rand
9
+ assert_kind_of(Time, rand)
10
+ end
11
+
12
+ def test_rand_with_range
13
+ now = Time.now
14
+ range = (now - 1000)..(now + 1000)
15
+ rand = Time.rand(range)
16
+ assert_kind_of(Time, rand)
17
+ assert(range.begin <= rand && rand <= range.end)
18
+ end
19
+
20
+ end
21
+
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
+ Minitest::Test ||= MiniTest::Unit::TestCase
4
+ require 'simplecov'
5
+ SimpleCov.start
6
+
7
+ ['date','date_time','time'].map{|x|
8
+ require "sixarm_ruby_date_time_rand_test/#{x}_test.rb"
9
+ }
10
+
data.tar.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ �~6!��nٲ�+-��Vv�U.�Qg)ߚ�y@��sQ��S��u~�>�*���[�@���yq��1A��e6�����ߨ�r}���R���_u)A�0�>��(
2
+ c�%�y��u3q�qbk�L����|��
3
+ ��M��쌄� 
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sixarm_ruby_date_time_rand
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - SixArm
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDbDCCAlSgAwIBAgIBATANBgkqhkiG9w0BAQ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TVWrV
29
+ h6r4cFMt3X5Zu+euYxHqDuwWyub9hp4s30/ea38CoYNdIZcSFtpGuvhwVDU0x5dg
30
+ sWRVEyjnjnNuAeLP9zv43IDXjS22L2efhap7IOinYjcecpfXJgQaU+6BFAY4sdkQ
31
+ S1STYSfs3qySBxxAeEyZTw==
32
+ -----END CERTIFICATE-----
33
+ date: 2014-03-26 00:00:00.000000000 Z
34
+ dependencies: []
35
+ description: Adds extensions for DateTime#rand, Date#rand, Time#rand
36
+ email: sixarm@sixarm.com
37
+ executables: []
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - ".gemtest"
42
+ - CONTRIBUTING.md
43
+ - README.md
44
+ - Rakefile
45
+ - VERSION
46
+ - lib/sixarm_ruby_date_time_rand.rb
47
+ - lib/sixarm_ruby_date_time_rand/date.rb
48
+ - lib/sixarm_ruby_date_time_rand/date_time.rb
49
+ - lib/sixarm_ruby_date_time_rand/time.rb
50
+ - test/sixarm_ruby_date_time_rand_test.rb
51
+ - test/sixarm_ruby_date_time_rand_test/date_test.rb
52
+ - test/sixarm_ruby_date_time_rand_test/date_time_test.rb
53
+ - test/sixarm_ruby_date_time_rand_test/time_test.rb
54
+ homepage: http://sixarm.com/
55
+ licenses:
56
+ - BSD
57
+ - GPL
58
+ - MIT
59
+ - PAL
60
+ - Various
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.2.0
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: 'SixArm.com » Ruby » Date and Time #rand methods'
82
+ test_files:
83
+ - test/sixarm_ruby_date_time_rand_test.rb
84
+ - test/sixarm_ruby_date_time_rand_test/date_test.rb
85
+ - test/sixarm_ruby_date_time_rand_test/date_time_test.rb
86
+ - test/sixarm_ruby_date_time_rand_test/time_test.rb
87
+ has_rdoc: true
metadata.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ Zn�QT�R
2
+ ci&��Z�̈́���& [���A���"A.��F��W�i5��=~�kl�ɃR%�f���@���ҏc��hx������4Q���:�]z�ҹ�,�'�V��&��b�C���~��g?��{0p��.6���1r6�{����gG�Ԟ�~��ď�* \���_����X�9k7"ȓCz�{�5'�f���X$y��ި~��)F�b.��4D[� �>Z�����믘؆#�OmM���h�