Class: ConvenientService::Utils::Object::MemoizeIncludingFalsyValues Private
- Inherits:
-
Support::Command
- Object
- Support::Command
- ConvenientService::Utils::Object::MemoizeIncludingFalsyValues
- Defined in:
- lib/convenient_service/utils/object/memoize_including_falsy_values.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
false and nil are the only values that are considered falsy in Ruby.
Can be used instead of return @ivar if defined? @ivar.
Instance Attribute Summary collapse
- #ivar_name ⇒ Object readonly private
- #object ⇒ Object readonly private
- #value_block ⇒ Object readonly private
Instance Method Summary collapse
-
#call ⇒ Object
private
Value of ivar.
- #initialize(object, ivar_name, &value_block) ⇒ void constructor private
Methods inherited from Support::Command
Constructor Details
#initialize(object, ivar_name, &value_block) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
48 49 50 51 52 |
# File 'lib/convenient_service/utils/object/memoize_including_falsy_values.rb', line 48 def initialize(object, ivar_name, &value_block) @object = object @ivar_name = ivar_name @value_block = value_block end |
Instance Attribute Details
#ivar_name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/convenient_service/utils/object/memoize_including_falsy_values.rb', line 34 def ivar_name @ivar_name end |
#object ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 |
# File 'lib/convenient_service/utils/object/memoize_including_falsy_values.rb', line 28 def object @object end |
#value_block ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
40 41 42 |
# File 'lib/convenient_service/utils/object/memoize_including_falsy_values.rb', line 40 def value_block @value_block end |
Instance Method Details
#call ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Value of ivar. Can be any type.
57 58 59 |
# File 'lib/convenient_service/utils/object/memoize_including_falsy_values.rb', line 57 def call Utils::Object.instance_variable_fetch(object, ivar_name, &value_block) end |