Class: SleepingKingStudios::Tools::Toolbelt

Inherits:
BasicObject
Defined in:
lib/sleeping_king_studios/tools/toolbelt.rb

Overview

Helper object for quick access to all available tools.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(deprecation_strategy: nil, inflector: nil) ⇒ Toolbelt

Returns a new instance of Toolbelt.

Parameters:

  • deprecation_strategy (String) (defaults to: nil)

    The name of the strategy used when deprecated code is called. Must be ‘ignore’, ‘raise’, or ‘warn’.

  • inflector (Object) (defaults to: nil)

    An object that conforms to the interface used by SleepingKingStudios::Tools::Toolbox::Inflector, such as ActiveSupport::Inflector .



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 19

def initialize(deprecation_strategy: nil, inflector: nil)
  @array_tools   = ::SleepingKingStudios::Tools::ArrayTools.new
  @assertions    = ::SleepingKingStudios::Tools::Assertions.new
  @core_tools    = ::SleepingKingStudios::Tools::CoreTools.new(
    deprecation_strategy: deprecation_strategy
  )
  @hash_tools    = ::SleepingKingStudios::Tools::HashTools.new
  @integer_tools = ::SleepingKingStudios::Tools::IntegerTools.new
  @object_tools  = ::SleepingKingStudios::Tools::ObjectTools.new
  @string_tools  =
    ::SleepingKingStudios::Tools::StringTools.new(inflector: inflector)
end

Instance Attribute Details

#array_toolsObject (readonly) Also known as: ary

Returns the value of attribute array_tools.



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

def array_tools
  @array_tools
end

#assertionsObject (readonly)

Returns the value of attribute assertions.



34
35
36
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 34

def assertions
  @assertions
end

#core_toolsObject (readonly)

Returns the value of attribute core_tools.



36
37
38
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 36

def core_tools
  @core_tools
end

#hash_toolsObject (readonly) Also known as: hsh

Returns the value of attribute hash_tools.



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

def hash_tools
  @hash_tools
end

#integer_toolsObject (readonly) Also known as: int

Returns the value of attribute integer_tools.



40
41
42
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 40

def integer_tools
  @integer_tools
end

#object_toolsObject (readonly) Also known as: obj

Returns the value of attribute object_tools.



42
43
44
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 42

def object_tools
  @object_tools
end

#string_toolsObject (readonly) Also known as: str

Returns the value of attribute string_tools.



44
45
46
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 44

def string_tools
  @string_tools
end

Class Method Details

.instanceSleepingKingStudios::Tools::Toolbelt

Returns a memoized instance of the toolbelt class.

Returns:



10
11
12
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 10

def self.instance
  @instance ||= new
end

Instance Method Details

#inspectString Also known as: to_s

Returns a human-readable representation of the object.

Returns:

  • (String)

    a human-readable representation of the object.



53
54
55
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 53

def inspect
  "#<#{::Object.instance_method(:class).bind(self).call.name}>"
end