Class: Models::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/models/log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Log

Returns a new instance of Log.



5
6
7
8
9
# File 'lib/models/log.rb', line 5

def initialize(attrs = {})
  attrs.each do |key, value|
    self.send("#{key}=", value) if respond_to?("#{key}=")
  end
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/models/log.rb', line 3

def created_at
  @created_at
end

#dataObject

Returns the value of attribute data.



3
4
5
# File 'lib/models/log.rb', line 3

def data
  @data
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/models/log.rb', line 3

def id
  @id
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/models/log.rb', line 3

def status
  @status
end

#updated_atObject

Returns the value of attribute updated_at.



3
4
5
# File 'lib/models/log.rb', line 3

def updated_at
  @updated_at
end

Instance Method Details

#attributes_hashObject



11
12
13
14
15
# File 'lib/models/log.rb', line 11

def attributes_hash
  instance_variables.each_with_object({}) do |var, hash|
    hash[var.to_s.delete('@').to_sym] = instance_variable_get(var)
  end
end

#jsonb(json) ⇒ Object



21
22
23
24
25
26
# File 'lib/models/log.rb', line 21

def jsonb(json)
  return if json.nil?
  return json if json.is_a?(String)

  Sequel&.pg_json(json)
end