bizhours 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/History.txt +5 -0
  2. data/Rakefile +1 -0
  3. data/lib/bizhours.rb +12 -10
  4. metadata +2 -2
@@ -1,3 +1,8 @@
1
+ === 1.0.1 / 2008-08-12
2
+
3
+ * Tidied up a bit
4
+
5
+
1
6
  === 1.0.0 / 2008-08-09
2
7
 
3
8
  * Initial Release
data/Rakefile CHANGED
@@ -12,6 +12,7 @@ Hoe.new('bizhours', Bizhours::VERSION) do |p|
12
12
  p.description = p.paragraphs_of('README.txt', 2..6).join("\n\n")
13
13
  p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
14
14
  p.extra_deps << ['duration', '>= 0.1.0']
15
+ p.remote_rdoc_dir = ''
15
16
  #p.developer('FIX', 'FIX@example.com')
16
17
  end
17
18
 
@@ -2,8 +2,9 @@ require 'rubygems'
2
2
  require 'duration'
3
3
  require 'date'
4
4
 
5
+
5
6
  module Bizhours
6
- VERSION = '1.0.0'
7
+ VERSION = '1.0.1'
7
8
  BIZHOURS = {
8
9
  :mon => [8,20],
9
10
  :tue => [8,20],
@@ -13,9 +14,9 @@ module Bizhours
13
14
  :sat => [9,18],
14
15
  :sun => [8,8]
15
16
  }
16
-
17
+
17
18
  ##
18
- #Takes 2 timestamps and returns a duration object of hours that match
19
+ #Takes 2 timestamps and returns a duration object of hours that match BIZHOURS for day
19
20
 
20
21
  def self.get_duration(startt, endt)
21
22
  #if start and end time is on same day do the following
@@ -43,11 +44,11 @@ module Bizhours
43
44
  end
44
45
  end
45
46
 
46
- startd = Time.local(startt.year, startt.month, startt.day)
47
- endd = Time.local(endt.year, endt.month, endt.day)
47
+ #startd = Time.local(startt.year, startt.month, startt.day)
48
+ #endd = Time.local(endt.year, endt.month, endt.day)
48
49
 
49
50
  duration = first_day_time(startt) + last_day_time(endt) + inbetween_day_time(startt, endt)
50
- return duration
51
+
51
52
  end
52
53
 
53
54
  private
@@ -75,7 +76,7 @@ module Bizhours
75
76
 
76
77
  elapsed = Duration.new(close - start)
77
78
 
78
- return elapsed
79
+
79
80
  end
80
81
 
81
82
  ##
@@ -99,7 +100,7 @@ module Bizhours
99
100
 
100
101
  elapsed = Duration.new(stop - open)
101
102
 
102
- return elapsed
103
+
103
104
  end
104
105
 
105
106
  ##
@@ -136,7 +137,7 @@ module Bizhours
136
137
  def self.business_hours_for_day(time)
137
138
 
138
139
  ##If your going to have custom hours do something like the following and comment out the diffhours = nil
139
- #diffhours = Hour.find(:first, :conditions => ["date = ?", time.to_date] )
140
+ #diffhours = Hour.find(:first, :conditions => ["date = ?", time.to_date] ) <-- Active Record
140
141
  #previous assumes table Hours, fields open and close
141
142
  diffhours = nil
142
143
  #if date is in database return them instead of defaults
@@ -149,4 +150,5 @@ module Bizhours
149
150
  end
150
151
  end
151
152
 
152
- #puts Bizhours::get_duration(Time.now, Time.now + 86400 + 86400 + 899986400)
153
+ #puts Bizhours.get_duration(Time.now, Time.now + 86400 + 86400 + 89998640)
154
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bizhours
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Curtis Carter
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-10 00:00:00 -05:00
12
+ date: 2008-08-12 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency