Class: SleepingKingStudios::Tools::Base

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/sleeping_king_studios/tools/base.rb

Overview

Abstract base class for Tools classes.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(toolbelt: nil) ⇒ Base

Returns a new instance of Base.

Parameters:



32
33
34
# File 'lib/sleeping_king_studios/tools/base.rb', line 32

def initialize(toolbelt: nil)
  @toolbelt = toolbelt
end

Class Method Details

.instanceSleepingKingStudios::Tools::Base

Deprecated.

v1.3.0 Use Toolbelt.instance instead.

Returns a memoized instance of the tools class.

Returns:



21
22
23
24
25
26
27
28
# File 'lib/sleeping_king_studios/tools/base.rb', line 21

def self.instance
  SleepingKingStudios::Tools::Toolbelt.instance.core_tools.deprecate(
    "#{name}.instance",
    message: 'Use Toolbelt.instance instead.'
  )

  @instance ||= new
end

Instance Method Details

#toolbeltSleepingKingStudios::Tools::Toolbelt Also known as: tools

Returns the toolbelt this tools instance belongs to, or the global toolbelt singleton.

Returns:



38
39
40
# File 'lib/sleeping_king_studios/tools/base.rb', line 38

def toolbelt
  @toolbelt ||= SleepingKingStudios::Tools::Toolbelt.global
end