Module: Inbox::TimeAttrAccessor

Included in:
RestfulModel, Thread
Defined in:
lib/time_attr_accessor.rb

Instance Method Summary collapse

Instance Method Details

#time_attr_accessor(attr) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/time_attr_accessor.rb', line 3

def time_attr_accessor(attr)
  parameter attr
  define_method "#{attr}=" do |value|
    if value
        instance_variable_set "@#{attr}", Time.at(value).utc
    end
  end
end