VanaTime 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/CHANGELOG +5 -0
  2. data/README +19 -13
  3. data/VanaTime.gemspec +4 -4
  4. data/lib/Vana/moon.rb +54 -21
  5. metadata +32 -39
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.2.0 / 2007-09-02
2
+
3
+ * fleshed out the VanaMoon API to make it more convenient and remove redundant
4
+ methods
5
+
1
6
  == 1.1.0 / 2007-08-27
2
7
 
3
8
  * rewrote and switched to echoe
data/README CHANGED
@@ -78,20 +78,26 @@ FFXI::VanaMoon API
78
78
 
79
79
  * new(Time)
80
80
  Unlike VanaDay, VanaMoon is initialized with the current earth time
81
- * to_i or moon_percent
81
+ * to_i
82
82
  returns a number representing the exact position along the progression
83
83
  of moon phases
84
- * moon_phase
85
- returns a base zero number representing the current moon phase
86
- * phase_name
87
- returns the name of the current phase (full, waning gibbous, etc)
88
- * next_optimal_phase
89
- returns a base zero number representing the next optimal moon phase
90
- * to_next_phase
91
- returns an array with a countdown until the next moon phase
92
- [day, hour, minute, second]
93
- * to_optimal_phase
94
- returns an array with a countdown until the next optimal phase with the
95
- same format as above
84
+ * percent
85
+ returns the absolute value of the percentage formatted
86
+ * phase
87
+ returns the name of the current moon phase
96
88
  * to_s
97
89
  returns a string in the format: moon_percent.abs phase_name
90
+ * to_next_array
91
+ returns an array containing the days, hours, minutes, and seconds until
92
+ the next moon phase
93
+ * to_next
94
+ returns a formatted countdown until the next moon phase
95
+ * next_phase
96
+ returns the name of the next moon phase
97
+ * to_optimal_array
98
+ returns an array containing the days, hours, minutes, and seconds until
99
+ the next optimal moon phase
100
+ * to_optimal
101
+ returns a formatted countdown until the next optimal moon phase
102
+ * optimal_phase
103
+ returns the name of the next optimal moon phase
@@ -1,11 +1,11 @@
1
1
 
2
- # Gem::Specification for Vanatime-1.1.0
2
+ # Gem::Specification for Vanatime-1.2.0
3
3
  # Originally generated by Echoe
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = %q{VanaTime}
7
- s.version = "1.1.0"
8
- s.date = %q{2007-08-30}
7
+ s.version = "1.2.0"
8
+ s.date = %q{2007-09-02}
9
9
  s.summary = %q{A library for converting realtime to vanadiel time}
10
10
  s.email = %q{ttilley@gmail.com}
11
11
  s.homepage = %q{http://vanatime.rubyforge.org/}
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  # # Original Rakefile source (requires the Echoe gem):
21
21
  #
22
- # version = "1.1.0"
22
+ # version = "1.2.0"
23
23
  #
24
24
  # ENV['RUBY_FLAGS'] = ""
25
25
  #
@@ -54,9 +54,50 @@ module FFXI
54
54
  end
55
55
  end
56
56
 
57
- attr_reader :elapsed_time, :moon_days, :moon_percent, :moon_phase,
58
- :next_optimal_phase
57
+ attr_reader :elapsed_time, :moon_days
59
58
 
59
+ def to_i
60
+ @moon_percent
61
+ end
62
+
63
+ def percent
64
+ "#{@moon_percent.abs}%"
65
+ end
66
+
67
+ def phase
68
+ MOON_PHASES[@moon_phase]
69
+ end
70
+
71
+ def to_s
72
+ "#{percent} #{phase}"
73
+ end
74
+
75
+ def to_next_array
76
+ countdown_to(@next_phase_target)
77
+ end
78
+
79
+ def to_next
80
+ format_countdown(to_next_array)
81
+ end
82
+
83
+ def next_phase
84
+ MOON_PHASES[(@moon_phase + 1) % 8]
85
+ end
86
+
87
+ def to_optimal_array
88
+ countdown_to(@optimal_phase_target)
89
+ end
90
+
91
+ def to_optimal
92
+ format_countdown(to_optimal_array)
93
+ end
94
+
95
+ def optimal_phase
96
+ MOON_PHASES[@next_optimal_phase]
97
+ end
98
+
99
+ private
100
+
60
101
  def countdown(time)
61
102
  day_left = time.to_f / MS_DAY
62
103
  hour_left = (day_left.to_f - day_left.floor) * 24
@@ -66,28 +107,20 @@ module FFXI
66
107
  [day_left.floor, hour_left.floor, min_left.floor, sec_left.floor]
67
108
  end
68
109
 
69
- def phase_countdown(target)
110
+ def countdown_to(target)
70
111
  countdown((target - @moon_days) * MS_GAME_DAY - @elapsed_time)
71
112
  end
72
-
73
- def to_next_phase
74
- phase_countdown(@next_phase_target)
75
- end
76
-
77
- def to_optimal_phase
78
- phase_countdown(@optimal_phase_target)
79
- end
80
-
81
- def to_i
82
- @moon_percent
83
- end
84
113
 
85
- def phase_name
86
- MOON_PHASES[@moon_phase]
87
- end
88
-
89
- def to_s
90
- "#{@moon_percent.abs}% #{phase_name}"
114
+ def format_countdown(countdown)
115
+ formatted = String.new
116
+ countdown[0..2].each do |part|
117
+ if (part > 0)
118
+ formatted += "%02d" % part
119
+ formatted += ":"
120
+ end
121
+ end
122
+ formatted += "%02d" % countdown[3]
123
+ formatted
91
124
  end
92
125
  end
93
126
  end
metadata CHANGED
@@ -1,33 +1,11 @@
1
- --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
- name: VanaTime
5
- version: !ruby/object:Gem::Version
6
- version: 1.1.0
7
- date: 2007-08-30 00:00:00 -04:00
8
- summary: A library for converting realtime to vanadiel time
9
- require_paths:
10
- - lib
11
- email: ttilley@gmail.com
1
+ --- !ruby/object:Gem::Specification
12
2
  homepage: http://vanatime.rubyforge.org/
13
- rubyforge_project: vanatime
14
- description: A library for converting realtime to vanadiel time
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
25
- platform: ruby
26
- signing_key:
27
- cert_chain:
3
+ extensions: []
4
+ executables: []
5
+ version: !ruby/object:Gem::Version
6
+ version: 1.2.0
28
7
  post_install_message:
29
- authors:
30
- - Travis Tilley
8
+ date: 2007-09-02 04:00:00 +00:00
31
9
  files:
32
10
  - README
33
11
  - Manifest
@@ -39,17 +17,32 @@ files:
39
17
  - lib/Vana/constants.rb
40
18
  - CHANGELOG
41
19
  - VanaTime.gemspec
42
- test_files: []
43
-
20
+ rubygems_version: 0.9.4
44
21
  rdoc_options: []
45
-
22
+ signing_key:
23
+ cert_chain:
24
+ name: VanaTime
25
+ has_rdoc: true
26
+ platform: ruby
27
+ summary: A library for converting realtime to vanadiel time
28
+ default_executable:
29
+ bindir: bin
30
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
31
+ version:
32
+ requirements:
33
+ - - '>'
34
+ - !ruby/object:Gem::Version
35
+ version: 0.0.0
36
+ require_paths:
37
+ - lib
38
+ specification_version: 1
39
+ test_files: []
40
+ dependencies: []
41
+ description: A library for converting realtime to vanadiel time
42
+ authors:
43
+ - Travis Tilley
44
+ email: ttilley@gmail.com
46
45
  extra_rdoc_files: []
47
-
48
- executables: []
49
-
50
- extensions: []
51
-
52
46
  requirements: []
53
-
54
- dependencies: []
55
-
47
+ rubyforge_project: vanatime
48
+ autorequire: