buzztools 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 320d51c42d547c7e42fe13a0a826ede863c5ae9d
4
- data.tar.gz: 1bf666b0b7ecf8e9d53f4577b5c0ebffdac4f427
3
+ metadata.gz: 1eaae1e1dab86ea0752de2655f0a62b0f20662ac
4
+ data.tar.gz: 113bda67b24d33fddcc40cbc4336c71acbcbe601
5
5
  SHA512:
6
- metadata.gz: 0f21340054a89534634e98c7cca94face37f7d2a2cd609491035cb4086016f2550ef6ff352850bc83c68844c4df0843c50ea1c1017eb8972348da32c1e791ac7
7
- data.tar.gz: 16aefd84048043aab6cca963173e0583d9fb8e9ae0ff5b595d0d3475e3a45e92791bd51f2fce9f43fc9b94fc8cc135ab7361e3111f58817b42887139cbac3ead
6
+ metadata.gz: 03b1c16af683d35b6aaf30f396b902cee0b89df02c58a7c2017c696bf7524558c90f59bc118ce6744f1fc42cbfff087fd0d099caa3e7d932edeabf04aea0e28b
7
+ data.tar.gz: cb5dd2f7db57b298bfdbe41c8e1037d9c39dd711e1a91cb484007991383877e917ab1599b707c34e7c543eba0629d6c14e4cdf9bbec0758ae06c65e4f8f1d005
@@ -4,8 +4,20 @@ Bignum.class_eval do
4
4
  self==0 ? false : true
5
5
  end
6
6
 
7
+ def to_ms # eg. for 1.minute.to_ms
8
+ self*1000.0
9
+ end
10
+
7
11
  end
8
12
 
9
- # Float.class_eval do
10
- #
11
- # end
13
+ Float.class_eval do
14
+
15
+ def to_b(aDefault=false)
16
+ self==0 ? false : true
17
+ end
18
+
19
+ def to_ms # eg. for 1.minute.to_ms
20
+ self*1000.0
21
+ end
22
+
23
+ end
@@ -8,4 +8,7 @@ Fixnum.class_eval do
8
8
  (!aMin || (self >= aMin)) && (!aMax || (self <= aMax)) ? self : aDefault
9
9
  end
10
10
 
11
+ def to_ms # eg. for 1.minute.to_ms
12
+ self*1000
13
+ end
11
14
  end
@@ -91,4 +91,30 @@ Time.class_eval do
91
91
  def self.from_ms(aMilliseconds)
92
92
  at(aMilliseconds/1000.0)
93
93
  end
94
+
95
+ def iso8601ms
96
+ iso8601(3)
97
+ end
98
+
99
+ def zoneless
100
+ (self + self.utc_offset).utc
101
+ end
102
+
103
+ # sets the zone without affecting the hour or day
104
+ def to_zone(aHours)
105
+ self.in_time_zone(aHours)+self.utc_offset-aHours.to_i.hours
106
+ end
94
107
  end
108
+
109
+ if defined? ActiveSupport::TimeWithZone
110
+ ActiveSupport::TimeWithZone.class_eval do
111
+ def zoneless
112
+ (self + self.utc_offset).utc
113
+ end
114
+
115
+ # sets the zone without affecting the hour or day
116
+ def to_zone(aHours)
117
+ self.in_time_zone(aHours)+self.utc_offset-aHours.to_i.hours
118
+ end
119
+ end
120
+ end
@@ -62,3 +62,9 @@ String.class_eval do
62
62
  self
63
63
  end
64
64
  end
65
+
66
+ Time.class_eval do
67
+ def to_nil
68
+ self
69
+ end
70
+ end
@@ -1,3 +1,3 @@
1
1
  module Buzztools
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buzztools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary McGhee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-11 00:00:00.000000000 Z
11
+ date: 2015-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  requirements: []
90
90
  rubyforge_project:
91
- rubygems_version: 2.4.5
91
+ rubygems_version: 2.4.6
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: reusable function library