stardate 2.1.0 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/stardate.rb CHANGED
@@ -42,6 +42,10 @@ class Stardate
42
42
  1.0/12.0
43
43
  end
44
44
 
45
+ def lifespan
46
+ 80.0
47
+ end
48
+
45
49
  def rename(filename, mode = :mtime)
46
50
  case mode
47
51
  when :mtime
@@ -108,6 +112,10 @@ class Stardate
108
112
  def to_f
109
113
  @stardate
110
114
  end
115
+
116
+ def to_femtoyears
117
+ (@stardate * 1e15).to_i
118
+ end
111
119
 
112
120
  def to_filename(filename)
113
121
  ext = File.extname filename
@@ -11,6 +11,10 @@ class StardateInterval
11
11
  StardateInterval.new @stop, @start
12
12
  end
13
13
 
14
+ def lifespans
15
+ years / Stardate.lifespan
16
+ end
17
+
14
18
  def years
15
19
  @stop.stardate - @start.stardate
16
20
  end
@@ -56,7 +60,7 @@ class StardateInterval
56
60
  end
57
61
 
58
62
  def to_human(precision = 3)
59
- [ :years, :months, :weeks, :days, :hours, :minutes, :seconds, :milliseconds ].each do |scale|
63
+ [ :lifespans, :years, :months, :weeks, :days, :hours, :minutes, :seconds, :milliseconds ].each do |scale|
60
64
  x = public_send scale
61
65
  return "%.#{precision}f %s" % [x, scale] if x.abs >= 1
62
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stardate
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-28 00:00:00.000000000 Z
12
+ date: 2013-01-05 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Stardate representation
15
15
  email: zlkm208-rubygems@yahoo.com