ddate 0.9.0 → 1.0.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.
@@ -7,4 +7,9 @@
7
7
  +++ 0.9.0 2007-06-02
8
8
 
9
9
  + 1 major enhancement:
10
- + Terminal program will now give the Discordian date corresponding to a date in the Julian calendar
10
+ + Terminal program will now give the Discordian date corresponding to a date in the Julian calendar
11
+
12
+ +++ 1.0.0 2007-06-04
13
+
14
+ + 1 major enhancement:
15
+ + Format strings now supported
@@ -95,14 +95,32 @@ class DDate
95
95
  end
96
96
 
97
97
 
98
- def to_s
99
- if tibs_day?
100
- "#{day_of_week_name} of #{month} #{year} YOLD"
101
- else
102
- result = "#{day_of_week_name}, #{day_of_month} of #{month} #{year} YOLD"
103
- result += " and the holiday of #{holyday}" if holyday
104
- result
98
+ def to_s(format_str="%W[, %d] of %M %y YOLD{ and the holyday of %H}")
99
+ format(format_str)
100
+ end
101
+
102
+ def format(str)
103
+ formattings = [["%w","day_of_week"],
104
+ ["%W","day_of_week_name"],
105
+ ["%d","day_of_month"],
106
+ ["%m","month_number"],
107
+ ["%M","month"],
108
+ ["%H","holyday"],
109
+ ["%y","year"]]
110
+ formattings.each do |from,to|
111
+ str.gsub!(from,eval(to).to_s)
112
+ end
113
+ bracketings = [["{}","!holyday or tibs_day?"],
114
+ ["[]","tibs_day?"]]
115
+ bracketings.each do |wrappers,condition|
116
+ if eval(condition)
117
+ regex = Regexp.new("\\" + wrappers[0,1] + ".*" + "\\" + wrappers[1,1])
118
+ else
119
+ regex = Regexp.new("[\\" + wrappers[0,1] + "\\" + wrappers[1,1] + "]")
120
+ end
121
+ str.gsub!(regex,"")
105
122
  end
123
+ str
106
124
  end
107
125
 
108
126
  def tib_year?
@@ -1,7 +1,7 @@
1
1
  class DDate #:nodoc:
2
2
  module VERSION #:nodoc:
3
- MAJOR = 0
4
- MINOR = 9
3
+ MAJOR = 1
4
+ MINOR = 0
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
@@ -34,7 +34,7 @@
34
34
  <p>A cross-platform ruby implementation of the unix command <a href="http://www.linuxcommand.org/man_pages/ddate1.html">ddate</a>.</p>
35
35
 
36
36
 
37
- <p class="update">Update!: The terminal program will now give the Discordian date corresponding to a date in the Julian calendar.</p>
37
+ <p class="update">Update! Now you can get the Discordian date corresponding to any given Julian date</p>
38
38
 
39
39
  <h2>Installing</h2>
40
40
 
@@ -4,7 +4,7 @@ Gives the current date in the [Discordian Calendar](http://en.wikipedia.org/wiki
4
4
 
5
5
  A cross-platform ruby implementation of the unix command [ddate](http://www.linuxcommand.org/man_pages/ddate1.html).
6
6
 
7
- <p class="update">Update!: The terminal program will now give the Discordian date corresponding to a date in the Julian calendar.</p>
7
+ <p class="update">Update! Now you can get the Discordian date corresponding to any given Julian date</p>
8
8
 
9
9
  h2. Installing
10
10
 
@@ -23,7 +23,7 @@ li {
23
23
  list-style-type: square;
24
24
  }
25
25
  a:visited{
26
- color: #336;
26
+ color: #339;
27
27
  }
28
28
  a:hover{
29
29
  text-decoration: underline;
@@ -141,4 +141,8 @@ pre, code {
141
141
  padding-left: 15px;
142
142
  padding-right: 15px;
143
143
  padding-top: 4px;
144
+ }
145
+
146
+ .update {
147
+ font-style: italic;
144
148
  }
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.3
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: ddate
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.9.0
7
- date: 2007-06-02 00:00:00 -05:00
6
+ version: 1.0.0
7
+ date: 2007-06-05 00:00:00 -05:00
8
8
  summary: Implements the Discordian calendar, printing out the current date
9
9
  require_paths:
10
10
  - lib
@@ -46,10 +46,14 @@ files:
46
46
  test_files:
47
47
  - test/test_ddate.rb
48
48
  - test/test_helper.rb
49
- rdoc_options: []
50
-
51
- extra_rdoc_files: []
52
-
49
+ rdoc_options:
50
+ - --main
51
+ - README.txt
52
+ extra_rdoc_files:
53
+ - History.txt
54
+ - Manifest.txt
55
+ - README.txt
56
+ - website/index.txt
53
57
  executables:
54
58
  - ddate
55
59
  extensions: []