Module: ConvenientService::Utils::Object

Defined in:
lib/convenient_service/utils/object.rb,
lib/convenient_service/utils/object/safe_send.rb,
lib/convenient_service/utils/object/duck_class.rb,
lib/convenient_service/utils/object/clamp_class.rb,
lib/convenient_service/utils/object/resolve_type.rb,
lib/convenient_service/utils/object/get_own_method.rb,
lib/convenient_service/utils/object/instance_variable_fetch.rb,
lib/convenient_service/utils/object/instance_variable_delete.rb,
lib/convenient_service/utils/object/memoize_including_falsy_values.rb

Defined Under Namespace

Classes: ClampClass, DuckClass, GetOwnMethod, InstanceVariableDelete, InstanceVariableFetch, MemoizeIncludingFalsyValues, ResolveType, SafeSend

Class Method Summary collapse

Class Method Details

.clamp_classObject

Examples:

ConvenientService::Utils::Object.clamp_class("foo")


20
21
22
# File 'lib/convenient_service/utils/object.rb', line 20

def clamp_class(...)
  ClampClass.call(...)
end

.duck_classObject

Examples:

ConvenientService::Utils::Object.duck_class("foo")


28
29
30
# File 'lib/convenient_service/utils/object.rb', line 28

def duck_class(...)
  DuckClass.call(...)
end

.instance_variable_deleteObject

Examples:

ConvenientService::Utils::Object.instance_variable_delete("abc", :@foo)


36
37
38
# File 'lib/convenient_service/utils/object.rb', line 36

def instance_variable_delete(...)
  InstanceVariableDelete.call(...)
end

.instance_variable_fetchObject

Examples:

ConvenientService::Utils::Object.instance_variable_fetch("abc", :@foo) { :bar }


44
45
46
# File 'lib/convenient_service/utils/object.rb', line 44

def instance_variable_fetch(...)
  InstanceVariableFetch.call(...)
end

.memoize_including_falsy_valuesObject

Examples:

object = Object.new.tap { |object| object.instance_eval { self.class.attr_reader :foo } }

ConvenientService::Utils.memoize_including_falsy_values(object, :@foo) { false }


54
55
56
# File 'lib/convenient_service/utils/object.rb', line 54

def memoize_including_falsy_values(...)
  MemoizeIncludingFalsyValues.call(...)
end

.own_methodObject

Examples:

object = Object.new.tap { |object| object.instance_eval { self.class.attr_reader :foo } }

ConvenientService::Utils::Object.own_method(object, :foo)
# => #<Method: #<Object:0x0000555e524252d8>.foo() ...>

ConvenientService::Utils::Object.own_method(object, :puts)
# => nil


68
69
70
# File 'lib/convenient_service/utils/object.rb', line 68

def own_method(...)
  GetOwnMethod.call(...)
end

.resolve_typeObject

Examples:

ConvenientService::Utils::Object.resolve_type("foo")


76
77
78
# File 'lib/convenient_service/utils/object.rb', line 76

def resolve_type(...)
  ResolveType.call(...)
end

.safe_sendObject

Examples:

ConvenientService::Utils::Object.safe_send(object, method, *args, **kwargs, &block)


84
85
86
# File 'lib/convenient_service/utils/object.rb', line 84

def safe_send(...)
  SafeSend.call(...)
end