Skip to content

Commit

Permalink
Swallow NoMethodError on unstrict parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Ahearn committed Mar 31, 2014
1 parent b5dc76c commit 5416efe
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/icalendar/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def parse
calendars
end

def strict?
!!@strict
end

private

def parse_component(component)
Expand Down Expand Up @@ -62,10 +66,14 @@ def parse_component(component)
prop_value = klass.new fields[:value], fields[:params]
end
prop_name = %w(class method).include?(fields[:name]) ? "ip_#{fields[:name]}" : fields[:name]
if component.class.multiple_properties.include? prop_name
component.send "append_#{prop_name}", prop_value
else
component.send "#{prop_name}=", prop_value
begin
if component.class.multiple_properties.include? prop_name
component.send "append_#{prop_name}", prop_value
else
component.send "#{prop_name}=", prop_value
end
rescue NoMethodError => nme
raise nme if strict?
end
end
end
Expand Down

0 comments on commit 5416efe

Please sign in to comment.