Class: Nucleus::AbstractModel

Inherits:
Object
  • Object
show all
Includes:
Kwalify::Util::HashLike
Defined in:
lib/nucleus/core/models/abstract_model.rb

Overview

Author:

Since:

  • 0.1.0

Direct Known Subclasses

Endpoint, Provider, Vendor

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = nil) ⇒ AbstractModel

Returns a new instance of AbstractModel.

Since:

  • 0.1.0



13
14
15
16
17
# File 'lib/nucleus/core/models/abstract_model.rb', line 13

def initialize(hash = nil)
  return if hash.nil?
  @name = hash['name']
  @id = hash['id']
end

Instance Attribute Details

#created_atObject

Since:

  • 0.1.0



10
11
12
# File 'lib/nucleus/core/models/abstract_model.rb', line 10

def created_at
  @created_at
end

#idObject

Since:

  • 0.1.0



8
9
10
# File 'lib/nucleus/core/models/abstract_model.rb', line 8

def id
  @id
end

#nameObject

Since:

  • 0.1.0



9
10
11
# File 'lib/nucleus/core/models/abstract_model.rb', line 9

def name
  @name
end

#updated_atObject

Since:

  • 0.1.0



11
12
13
# File 'lib/nucleus/core/models/abstract_model.rb', line 11

def updated_at
  @updated_at
end

Instance Method Details

#inspectObject

Since:

  • 0.1.0



25
26
27
# File 'lib/nucleus/core/models/abstract_model.rb', line 25

def inspect
  to_s
end

#to_sObject

Since:

  • 0.1.0



19
20
21
22
23
# File 'lib/nucleus/core/models/abstract_model.rb', line 19

def to_s
  return name if self.respond_to?('name')
  return id if id
  super.to_s
end