Module: NxtSupport::HasTimeAttributes::ClassMethods

Defined in:
lib/nxt_support/serializers/has_time_attributes.rb

Instance Method Summary collapse

Instance Method Details

#attribute_as_iso8601(attr_name) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/nxt_support/serializers/has_time_attributes.rb', line 12

def attribute_as_iso8601(attr_name)
  define_method(attr_name) do
    object.send(attr_name)&.iso8601
  end

  attribute attr_name
end

#attributes_as_iso8601(*attr_names) ⇒ Object



6
7
8
9
10
# File 'lib/nxt_support/serializers/has_time_attributes.rb', line 6

def attributes_as_iso8601(*attr_names)
  attr_names.each do |attr_name|
    attribute_as_iso8601(attr_name)
  end
end