lib/hungry/venue.rb in hungry-0.1.5 vs lib/hungry/venue.rb in hungry-0.2.0

- old
+ new

@@ -47,19 +47,19 @@ ### ATTRIBUTES: ### Preview: attr_accessor :id, :name, :category, :telephone, :fax, :website_url, :tagline, :rating, :url, :address, :geolocation, - :currency_symbol, :relevance, :distance, :plan, + :currency_symbol, :relevance, :distance, :plan, :mobile, ### Full: :reachability, :staff, :prices, :capacity, :description, :tags, :menus, :images, :maintainers, :awards, :opening_hours, :holidays, ### Utility: - :counters, :created_at, :updated_at, :status + :counters, :created_at, :updated_at, :status, :open_since lazy_load :tags, :menus, :maintainers, :opening_hours, :holidays def geolocation=(new_coordinates) @geolocation = Geolocation.parse(new_coordinates).tap do |geo| @@ -70,9 +70,16 @@ def menus=(new_menus) @menus = new_menus.map do |attributes| menu = Menu.new(attributes) menu.data_source = data_source menu + end + end + + %w[created_at updated_at open_since].each do |method| + define_method("#{method}=") do |new_value| + parsed_value = new_value.present? ? Time.parse(new_value) : nil + instance_variable_set("@#{method}", parsed_value) end end end end