hebrew_date 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/hebrew_date.gemspec +1 -1
- data/lib/hebrew_date.rb +30 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed501da770884bb19509220ee67fe9070ada1072
|
4
|
+
data.tar.gz: a8115661af9a5d5f5d2c141b1c456fd8d368ff7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1826d00264e75d19a8faedfa13765caa7523199f9b38e92db560ecd373003442a058dd6707eb0cf17c809d5803a1a5ac513d5569546552b22c8507209a4d6122
|
7
|
+
data.tar.gz: 768850c75fb273074c214a57e91892916e6af7e00ed150a5369cb16e04ee430c0428cc4746c820765e327a612273e7d38f19e2f9c2c46948964afb63a0b1d551
|
data/hebrew_date.gemspec
CHANGED
data/lib/hebrew_date.rb
CHANGED
@@ -110,6 +110,36 @@ class HebrewDate < Delegator
|
|
110
110
|
HebrewDate.new(self.to_date)
|
111
111
|
end
|
112
112
|
|
113
|
+
# Comparison operator.
|
114
|
+
# @param other [HebrewDate]
|
115
|
+
# @return [Integer] -1, 0, or 1
|
116
|
+
def <=>(other)
|
117
|
+
self.to_date <=> other.to_date
|
118
|
+
end
|
119
|
+
|
120
|
+
# Iterates evaluation of the given block, which takes a HebrewDate object.
|
121
|
+
# The limit should be a Date or HebrewDate object.
|
122
|
+
def step(limit, step=1)
|
123
|
+
return to_enum(:step, limit, step) unless block_given?
|
124
|
+
(self..limit).step(step) { |date| yield(date) }
|
125
|
+
end
|
126
|
+
|
127
|
+
# This method is equivalent to step(min, -1){|date| ...}.
|
128
|
+
# @param min [Integer]
|
129
|
+
# @return [Enumerator|self]
|
130
|
+
def downto(min)
|
131
|
+
return to_enum(:downto, min) unless block_given?
|
132
|
+
self.step(min, -1, &block)
|
133
|
+
end
|
134
|
+
|
135
|
+
# This method is equivalent to step(max, 1){ |date| ...}.
|
136
|
+
# @param max [Integer]
|
137
|
+
# @return [Enumerator|self]
|
138
|
+
def upto(max)
|
139
|
+
return to_enum(:upto, max) unless block_given?
|
140
|
+
self.step(max, 1, &block)
|
141
|
+
end
|
142
|
+
|
113
143
|
# Create a HebrewDate with initialized Hebrew date values.
|
114
144
|
# @param year [Integer] the Hebrew year (e.g. 5774)
|
115
145
|
# @param month [Integer] the Hebrew month (1-13)
|