Sha256: 1687bb3ccb8cea6f71bdf95597b22a69423059176ee3209ab52c9d911387e546
Contents?: true
Size: 631 Bytes
Versions: 1
Compression:
Stored size: 631 Bytes
Contents
require 'mayu/relation' module Mayu Association = Struct.new(:mac, :ip, :user_key, :ap_key, :updated_at, :appeared_at, :disappeared_at, keyword_init: true) do include Mayu::Relation def self.load(obj) new(**obj) end def device_key mac end relates :ap relates :user relates :device alias found_user user def user user_key ? found_user : device.user end def as_json { user_key: user&.key, ap_key: ap_key, updated_at: updated_at, appeared_at: appeared_at, disappeared_at: disappeared_at, } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mayu-0.1.0.beta1 | lib/mayu/association.rb |