class Pupa::ForeignObject

A minimal model for a foreign object.

Attributes

attributes[R]
foreign_keys[R]

Public Class Methods

new(properties = {}) click to toggle source
# File lib/pupa/models/foreign_object.rb, line 11
def initialize(properties = {})
  hash = symbolize_keys(properties)
  value = hash.delete(:foreign_keys) || {}
  @attributes = hash.merge(value)
  @foreign_keys = value.keys
end

Public Instance Methods

to_h() click to toggle source
# File lib/pupa/models/foreign_object.rb, line 18
def to_h
  {}.tap do |hash|
    attributes.each do |property,value|
      if value == false || value.present?
        hash[property] = value
      end
    end
  end
end