module Devise::Activeresource::PatchMethods

Public Class Methods

new(*) click to toggle source
Calls superclass method
# File lib/devise/activeresource/patch_methods.rb, line 4
def initialize(*)
  super
  return unless self.class.schema

  keys = self.class.schema.select { |_k, v| v == 'timestamp' }.keys
  keys.each do |k|
    value = send(k.to_sym)
    next unless value.is_a?(String)

    send("#{k}=".to_sym, Time.parse(value))
  end
end

Public Instance Methods

[](attribute_name) click to toggle source
Calls superclass method
# File lib/devise/activeresource/patch_methods.rb, line 33
def [](attribute_name)
  if attributes.include?(attribute_name)
    attributes[attribute_name]
  elsif respond_to?(attribute_name)
    send(attribute_name)
  else
    super
  end
end
assign_attributes(attributes = {}) click to toggle source
# File lib/devise/activeresource/patch_methods.rb, line 21
def assign_attributes(attributes = {})
  unless attributes.respond_to?(:to_hash)
    raise ArgumentError, 'expected attributes to be able to convert'\
      " to Hash, got #{attributes.inspect}"
  end

  attributes = attributes.to_hash
  attributes.each do |key, value|
    send("#{key}=".to_sym, value)
  end
end
invalid?() click to toggle source
# File lib/devise/activeresource/patch_methods.rb, line 17
def invalid?
  !valid?
end