sugarcube 3.0.5 → 3.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d52580e3773a931152ef302be052a43d462bcc0c
4
- data.tar.gz: de1452399490a8508da53a2bc56e0dfb3de304cc
3
+ metadata.gz: 3a18aa0e7e38e8d512d750f820034f11692c7982
4
+ data.tar.gz: b856bad2cebf2af6e45a0f64b15a3b9a7561368e
5
5
  SHA512:
6
- metadata.gz: 3ea2ceb3212c6f2460ac08f8b1491423020fff054df580319aea7bb86256bc44cccc3ef0f0adc1592ffdfd46b17b041416467509d244e98c26c18d83c06a78c5
7
- data.tar.gz: 5524449dbaa7e15fe6831ec4252dc8794a516fb5d6710499ca4898309ee9e18990195dc39eedfbf9dc1a985f6db6dfae5f9fadea7bbfdf70780c805a64736ca2
6
+ metadata.gz: 78bdc053c9b703528c9eeef6eb6cfe05e5df324456b802eb7f1d819ded480d8675e74c2b2c372af2ccb9002f9113c51785f2e88e8461b3e7c7a98081b39ed54a
7
+ data.tar.gz: b85067e46bc080acef4094e15992d0209a75d3110e3ef228f0f5abf03029126013bf28f44f89b80dfd09e301664deb99c55d34cfe2643af219b12124b59e67a8
@@ -54,7 +54,7 @@ class NSDate
54
54
  def string_with_format(format, options={})
55
55
  locale = options[:locale] || NSLocale.currentLocale
56
56
  timezone = options[:timezone] || NSTimeZone.defaultTimeZone
57
-
57
+
58
58
  if format.is_a?(Symbol)
59
59
  formatters = SugarCubeFormats[format]
60
60
  raise "No format found for #{format.inspect}" unless formatters
@@ -125,6 +125,16 @@ class NSDate
125
125
  return same_day?(today)
126
126
  end
127
127
 
128
+ def tomorrow?
129
+ tomorrow = self.class.tomorrow
130
+ return same_day?(tomorrow)
131
+ end
132
+
133
+ def yesterday?
134
+ yesterday = self.class.yesterday
135
+ return same_day?(yesterday)
136
+ end
137
+
128
138
  def same_day?(other)
129
139
  return other.day == self.day &&
130
140
  other.month == self.month &&
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '3.0.5'
2
+ Version = '3.0.6'
3
3
  end
@@ -125,6 +125,25 @@ describe "NSDate" do
125
125
  it "should have an NSDate#today method" do
126
126
  @date.today?.should == false
127
127
  NSDate.new.today?.should === true
128
+ NSDate.today.today?.should == true
129
+ NSDate.today.yesterday?.should == false
130
+ NSDate.today.tomorrow?.should == false
131
+ end
132
+
133
+ it "should have an NSDate#tomorrow method" do
134
+ @date.tomorrow?.should == false
135
+ NSDate.new.tomorrow?.should === false
136
+ NSDate.tomorrow.tomorrow?.should == true
137
+ NSDate.tomorrow.today?.should == false
138
+ NSDate.tomorrow.yesterday?.should == false
139
+ end
140
+
141
+ it "should have an NSDate#yesterday method" do
142
+ @date.yesterday?.should == false
143
+ NSDate.new.yesterday?.should === false
144
+ NSDate.yesterday.yesterday?.should == true
145
+ NSDate.yesterday.tomorrow?.should == false
146
+ NSDate.yesterday.today?.should == false
128
147
  end
129
148
 
130
149
  it "should have an NSDate#same_day method" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarcube
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin T.A. Gray
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-01-08 00:00:00.000000000 Z
14
+ date: 2015-01-14 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: |
17
17
  == Description