class Redox::Models::Model

Public Class Methods

new(data = {}) click to toggle source
Calls superclass method
# File lib/redox/models/model.rb, line 93
def initialize(data = {})
  if data.is_a?(Hash)
    if data.include?(key)
      data = data[key]
    elsif data.include?(key.to_sym)
      data = data[key.to_sym]
    end
  end

  super(data)
end

Public Instance Methods

to_h() click to toggle source
Calls superclass method
# File lib/redox/models/model.rb, line 105
def to_h
  return { key => super.to_h }
end

Private Instance Methods

key() click to toggle source
# File lib/redox/models/model.rb, line 110
def key
  return self.class.to_s.split('::').last.to_s
end