Class: Kennel::Models::Base

Inherits:
Object
  • Object
show all
Extended by:
SubclassTracking
Includes:
SettingsAsMethods
Defined in:
lib/kennel/models/base.rb

Direct Known Subclasses

Project, Record, Team

Constant Summary collapse

SETTING_OVERRIDABLE_METHODS =
[:name, :kennel_id].freeze

Instance Method Summary collapse

Methods included from SubclassTracking

recursive_subclasses, subclasses

Methods included from SettingsAsMethods

included, #initialize, #raise_with_location

Instance Method Details

#kennel_idObject



12
13
14
15
16
17
18
# File 'lib/kennel/models/base.rb', line 12

def kennel_id
  name = self.class.name
  if name.start_with?("Kennel::")
    raise_with_location ArgumentError, "Set :kennel_id"
  end
  @kennel_id ||= Utils.snake_case name
end

#nameObject



20
21
22
# File 'lib/kennel/models/base.rb', line 20

def name
  self.class.name
end

#to_jsonObject

rubocop:disable Lint/ToJSON

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/kennel/models/base.rb', line 24

def to_json # rubocop:disable Lint/ToJSON
  raise NotImplementedError, "Use as_json"
end