Permalink
Browse files

Fixed Ticket #26, failing with date values for event dtstart and dtend

  • Loading branch information...
1 parent d4a423c commit e81f8f47e45fe2f48b32a4bb95c4cfee829f1c4e @rubyredrick committed Sep 27, 2009
Showing with 32 additions and 5 deletions.
  1. +3 −1 History.txt
  2. +1 −1 lib/ri_cal/property_value.rb
  3. +11 −0 lib/ri_cal/property_value/date.rb
  4. +10 −0 spec/ri_cal/bugreports_spec.rb
  5. +7 −3 spec/spec_helper.rb
View
@@ -1,4 +1,4 @@
-=== 0.8.3 - 18 September 2009
+=== 0.8.4 - 18 September 2009
Refactored load structure, should now be conforming to
http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices
I did finesse the load path issue a bit as a workaround to RSpec not putting lib on $LOADPATH
@@ -8,6 +8,8 @@
please clean your code up to be quiet
Thanks to Ryan for such a courteous problem report.
+=== 0.8.3 - 18 September 2009
+ Released with bad gemspec
=== 0.8.2 - 4 September 2009
Fixes http://rick_denatale.lighthouseapp.com/projects/30941/tickets/23
initialization_methodsrb-syntax
@@ -53,7 +53,7 @@ def to_options_hash #:nodoc:
options_hash = {:value => value}
options_hash[:params] = params unless params.empty?
end
-
+
def self.date_or_date_time(timezone_finder, separated_line) # :nodoc:
match = separated_line[:value].match(/(\d\d\d\d)(\d\d)(\d\d)((T?)((\d\d)(\d\d)(\d\d))(Z?))?/)
raise Exception.new("Invalid date") unless match
@@ -91,6 +91,17 @@ def to_ri_cal_date_or_date_time_value
self
end
+ def for_parent(parent) #:nodoc:
+ if timezone_finder.nil?
+ @timezone_finder = parent
+ self
+ elsif parent == timezone_finder
+ self
+ else
+ Date.new(parent, :value => @date_time_value)
+ end
+ end
+
def advance(options) #:nodoc:
PropertyValue::Date.new(timezone_finder, :value => @date_time_value.advance(options), :params =>(params ? params.dup : nil) )
end
@@ -237,3 +237,13 @@
end
end
end
+
+context "ticket #26" do
+ context "Date property" do
+ it "should handle for_parent" do
+ lambda {
+ RiCal::PropertyValue::Date.convert(:foo, Date.parse("20090927")).for_parent(:bar)}.should_not raise_error
+ end
+ end
+end
+
View
@@ -4,10 +4,14 @@
require 'cgi'
require 'tzinfo'
+
module Kernel
- def rputs(*args)
- puts *["<pre>", args.collect {|a| CGI.escapeHTML(a.to_s)}, "</pre>"] #if RiCal.debug
- # puts *args
+ if ENV.keys.find {|env_var| env_var.match(/^TM_/)}
+ def rputs(*args)
+ puts( *["<pre>", args.collect {|a| CGI.escapeHTML(a.to_s)}, "</pre>"])
+ end
+ else
+ alias_method :rputs, :puts
end
end

0 comments on commit e81f8f4

Please sign in to comment.