Sha256: 666fa3d609af9b217ac5875c7f59c85cfa676c820ec6dd1a80a8cdcbaf9d98f4

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

module OldBill
  module V2
    module Neighbourhoods
      class Event < Hashie::Dash
              
        property :description	#Description of the event
        property :title	#Title of the event
        property :address	#Address of the event
        property :type	#Type of event
        property :contact_details 
        property :start_date
        property :session
        
        # email
        # telephone
        def contact_details_parsed(value)
          unless value.nil?
            Hashie::Mash.new(value)
          end
        end
        
        def start_date_parsed(value)
          unless value.nil?
            Date.parse(value)
          end
        end
        
        # == yak!!!!! refactor me please
        def []=(property, value)
          case property 
            when "contact_details"
            super(property.to_s, contact_details_parsed(value))
            when "start_date"
            super(property.to_s, start_date_parsed(value))
          else
            super
          end
        end
        
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oldbill-0.0.3 lib/oldbill/v2/neighbourhoods/event.rb
oldbill-0.0.2 lib/oldbill/v2/neighbourhoods/event.rb
oldbill-0.0.1 lib/oldbill/v2/neighbourhoods/event.rb