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.
Specific tools can be accessed by name. For example, to access the configured instance of ArrayTools, call Toolbelt#array_tools. Certain tools also define a shorthand - for example, the array_tools instance can also be accessed using Toolbelt#ary.
Instance Attribute Summary collapse
-
#array_tools ⇒ SleepingKingStudios::Tools::ArrayTools
(also: #ary)
readonly
Tools for working with array-like enumerable objects.
-
#assertions ⇒ SleepingKingStudios::Tools::Assertions
readonly
Methods for asserting on the state of a function or application.
-
#core_tools ⇒ SleepingKingStudios::Tools::CoreTools
readonly
Tools for working with an application or working environment.
-
#hash_tools ⇒ SleepingKingStudios::Tools::HashTools
(also: #hsh)
readonly
Tools for working with hash-like enumerable objects.
-
#integer_tools ⇒ SleepingKingStudios::Tools::IntegerTools
(also: #int)
readonly
Tools for working with integers.
-
#object_tools ⇒ SleepingKingStudios::Tools::ObjectTools
(also: #obj)
readonly
Low-level tools for working with objects.
-
#string_tools ⇒ SleepingKingStudios::Tools::ObjectTools
(also: #str)
readonly
Tools for working with strings.
Class Method Summary collapse
-
.instance ⇒ SleepingKingStudios::Tools::Toolbelt
A memoized instance of the toolbelt class.
Instance Method Summary collapse
-
#initialize(deprecation_caller_depth: nil, deprecation_strategy: nil, inflector: nil) ⇒ Toolbelt
constructor
A new instance of Toolbelt.
-
#inspect ⇒ String
(also: #to_s)
A human-readable representation of the object.
Constructor Details
#initialize(deprecation_caller_depth: nil, deprecation_strategy: nil, inflector: nil) ⇒ Toolbelt
Returns a new instance of Toolbelt.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 33 def initialize( # rubocop:disable Metrics/MethodLength deprecation_caller_depth: nil, deprecation_strategy: nil, inflector: nil ) @array_tools = ::SleepingKingStudios::Tools::ArrayTools.new @assertions = ::SleepingKingStudios::Tools::Assertions.new @core_tools = ::SleepingKingStudios::Tools::CoreTools.new( deprecation_caller_depth:, 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:) end |
Instance Attribute Details
#array_tools ⇒ SleepingKingStudios::Tools::ArrayTools (readonly) Also known as: ary
Returns tools for working with array-like enumerable objects.
54 55 56 |
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 54 def array_tools @array_tools end |
#assertions ⇒ SleepingKingStudios::Tools::Assertions (readonly)
Returns methods for asserting on the state of a function or application.
59 60 61 |
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 59 def assertions @assertions end |
#core_tools ⇒ SleepingKingStudios::Tools::CoreTools (readonly)
Returns tools for working with an application or working environment.
63 64 65 |
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 63 def core_tools @core_tools end |
#hash_tools ⇒ SleepingKingStudios::Tools::HashTools (readonly) Also known as: hsh
Returns tools for working with hash-like enumerable objects.
67 68 69 |
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 67 def hash_tools @hash_tools end |
#integer_tools ⇒ SleepingKingStudios::Tools::IntegerTools (readonly) Also known as: int
Returns tools for working with integers.
72 73 74 |
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 72 def integer_tools @integer_tools end |
#object_tools ⇒ SleepingKingStudios::Tools::ObjectTools (readonly) Also known as: obj
Returns low-level tools for working with objects.
77 78 79 |
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 77 def object_tools @object_tools end |
#string_tools ⇒ SleepingKingStudios::Tools::ObjectTools (readonly) Also known as: str
Returns tools for working with strings.
82 83 84 |
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 82 def string_tools @string_tools end |
Class Method Details
.instance ⇒ SleepingKingStudios::Tools::Toolbelt
Returns a memoized instance of the toolbelt class.
21 22 23 |
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 21 def self.instance @instance ||= new end |
Instance Method Details
#inspect ⇒ String Also known as: to_s
Returns a human-readable representation of the object.
86 87 88 |
# File 'lib/sleeping_king_studios/tools/toolbelt.rb', line 86 def inspect "#<#{::Object.instance_method(:class).bind(self).call.name}>" end |