Class: RubyRabbitmqJanus::Models::JanusInstance

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Mongoid::Document, Instances, Validations
Defined in:
lib/rrj/models/mongoid.rb,
lib/rrj/models/active_record.rb

Overview

Store instance information for MongoID database

Instance Method Summary collapse

Instance Method Details

#set(attributes) ⇒ Hash

Update attributes to document

Parameters:

  • attributes (Hash)

    List of attribute to update with this value

Returns:

  • (Hash)

    Current model



25
26
27
# File 'lib/rrj/models/active_record.rb', line 25

def set(attributes)
  update_columns(attributes)
end

#unset(attributes) ⇒ Hash

Destroy data to column

Parameters:

  • attributes (Array)

    List to attribute to delete in document

Returns:

  • (Hash)

    Current model



35
36
37
# File 'lib/rrj/models/active_record.rb', line 35

def unset(attributes)
  [attributes.map { |key, _value| [key, nil] }].to_h
end